您可以修改某些注册表项以使其可以在设备上运行任何可执行文件。在默认的Windows Mobile 6.0设备上,您会看到“是否允许_.exe运行?”弹出。如果您单击是,并且程序使注册表修改并重新启动设备,则任何应用程序都可以运行。
// Checks to see if the policies in the registry need to be adjusted to allow
// an unsigned program to run. This also affects WCELOAD.EXE as well.
// This is needed to run some programs on Windows Mobile 6 from an unsigned application.
void UpdatePolicy()
{
BOOL bPolicyNeedsUpdate = FALSE;
DWORD dwExistingPolicy = 0;
DWORD dwNewPolicy = 0;
HKEY hKey = NULL;
DWORD dwSize = sizeof(DWORD);
RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T("Security\\Policies\\Policies"), 0, NULL, 0,
KEY_ALL_ACCESS, NULL, &hKey, NULL);
// See if the policy has already been adjusted.
if (hKey != NULL)
{
DWORD dwType = 0;
RegQueryValueEx(hKey, _T("0000101a"), NULL, &dwType, (LPBYTE)&dwExistingPolicy, &dwSize);
if (dwExistingPolicy != 1)
bPolicyNeedsUpdate = TRUE;
}
if (bPolicyNeedsUpdate)
{
// Adjust the policy
dwNewPolicy = 1;
RegSetValueEx(hKey, _T("0000101a"), NULL, REG_DWORD, (const BYTE*)&dwNewPolicy, dwSize);
RegSetValueEx(hKey, _T("00001001"), NULL, REG_DWORD, (const BYTE*)&dwNewPolicy, dwSize);
dwNewPolicy = 40;
RegSetValueEx(hKey, _T("00001005"), NULL, REG_DWORD, (const BYTE*)&dwNewPolicy, dwSize);
dwNewPolicy = 144;
RegSetValueEx(hKey, _T("00001017"), NULL, REG_DWORD, (const BYTE*)&dwNewPolicy, dwSize);
// Reboot so the changes take effect
Reboot();
}
RegCloseKey(hKey);
}
void Reboot()
{
SetSystemPowerState(NULL, POWER_STATE_RESET, 0);
}
我已经发布了一种方法来删除某些Windows Mobile设备在C++中的代码签名要求。 – 2011-07-16 02:19:22