コード例 #1
0
int _tmain(int argc, _TCHAR* argv[])
{
	DWORD dwResuming = 4, dwSuspend = 4, dwUnattended = 4;
	RegistryGetDWORD(HKEY_LOCAL_MACHINE,	L"System\\CurrentControlSet\\Control\\Power\\State\\Resuming\\{98C5250D-C29A-4985-AE5F-AFE5367E5006}", 
											L"Default",
											&dwResuming);
	RegistryGetDWORD(HKEY_LOCAL_MACHINE,	L"System\\CurrentControlSet\\Control\\Power\\State\\Suspend\\{98C5250D-C29A-4985-AE5F-AFE5367E5006}", 
											L"Default",
											&dwSuspend);
	RegistryGetDWORD(HKEY_LOCAL_MACHINE,	L"System\\CurrentControlSet\\Control\\Power\\State\\Unattended\\{98C5250D-C29A-4985-AE5F-AFE5367E5006}", 
											L"Default",
											&dwUnattended);

	if (dwResuming == 0)
		dwResuming = 1;
	if (dwSuspend == 0)
		dwSuspend = 1;
	if (dwUnattended == 0)
		dwUnattended = 1;
	DWORD dwKeepWifi = 0;
	if (dwResuming == 1 && dwSuspend == 1 && dwUnattended == 1)
	{
		dwKeepWifi = 1;
	}
	RegistrySetDWORD(HKEY_LOCAL_MACHINE, L"Comm\\BCMSDDHD1\\Parms", L"HTCKeepWifiOnWhenUnattended", dwKeepWifi);
	return 0;
}
コード例 #2
0
ファイル: QuickLaunch.cpp プロジェクト: nbclark/flipper
void CQuickLaunch::SaveLaunchItems(HKEY hKey, list<LaunchItem*>* pLaunchItems)
{
	WCHAR wzName[MAX_PATH];
	DWORD dwName = sizeof(wzName);
	DWORD dwType;
	int index = 0;

	while (ERROR_SUCCESS == RegEnumValue(hKey, index, wzName, &dwName, NULL, &dwType, NULL, NULL))
	{
		dwName = sizeof(wzName);
		RegDeleteValue(hKey, wzName);
	}
	int count = pLaunchItems->size();
	RegistrySetDWORD(hKey, NULL, L"Count", count);

	index = 0;
	list<LaunchItem*>::iterator iter = pLaunchItems->begin();

	while (iter != pLaunchItems->end())
	{
		WCHAR wzPath[10], wzCount[5];
		DWORD dwSize = 0;
		_itow(index, wzCount, 10);

		StringCchCopy(wzPath, ARRAYSIZE(wzPath), wzCount);
		StringCchCat(wzPath, ARRAYSIZE(wzPath), L"_Path");

		LaunchItem* pRecord = *iter;
		RegistrySetString(hKey, NULL, wzPath, pRecord->wzPath);

		iter++;
		index++;
	}
}
コード例 #3
0
ファイル: cmnutils.cpp プロジェクト: NemProjects/WLAN
HRESULT SetWirelessStateFlags(UINT uMask, UINT uValue)
{
    HRESULT hr = S_OK;
    DWORD   dwData = 0;
    HKEY    hKey = NULL;

    CBR(ERROR_SUCCESS == RegCreateKeyEx(HKEY_LOCAL_MACHINE, c_szRegKeySSWifi,
                                        0, NULL, REG_OPTION_VOLATILE, 0, NULL, &hKey, NULL));

    RegistryGetDWORD(hKey, NULL, c_szRegValueSSWifi, &dwData);
    dwData = (dwData & ~uMask) | (uMask & uValue);
    CHR(RegistrySetDWORD(hKey, NULL, c_szRegValueSSWifi, dwData));

Error:
    RegCloseKey(hKey);
    return hr;
}
コード例 #4
0
ファイル: DateTime.cpp プロジェクト: nbclark/flipper
BOOL CALLBACK CDateTime::DateTimeProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) 
{
	static HWND hwndTimeZone;
	static HKEY g_hKey = NULL;
	static CDlgAnchor g_dlgAnchor;

    switch (message) 
    { 
		case WM_SIZE :
		{
			g_dlgAnchor.OnSize();
		}
		break;
        case WM_INITDIALOG:
        {
			g_dlgAnchor.Init(hwndDlg);
			g_dlgAnchor.Add(IDC_COMBO_TIMEZONE, ANCHOR_ALL &~ ANCHOR_BOTTOM);

			hwndTimeZone = GetDlgItem(hwndDlg, IDC_COMBO_TIMEZONE);

			TIME_ZONE_INFORMATION info = {0};
			GetTimeZoneInformation(&info);

			int index = ComboBox_AddString(hwndTimeZone, info.StandardName);
			index = ComboBox_SetItemData(hwndTimeZone, index, info.StandardBias);

			g_hKey = (HKEY)lParam;
			DWORD dwOffset = 0;
			RegistryGetDWORD(g_hKey, NULL, REG_TimeOffset, &dwOffset); 

			ComboBox_SetCurSel(hwndTimeZone, 0);

            SHINITDLGINFO shidi;
            // Create a Done button and size it.
            shidi.dwMask = SHIDIM_FLAGS;
            shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN;
            shidi.hDlg = hwndDlg;
            SHInitDialog(&shidi);

            SHMENUBARINFO mbi;
            memset(&mbi, 0, sizeof(SHMENUBARINFO));
            mbi.cbSize = sizeof(SHMENUBARINFO);
            mbi.hwndParent = hwndDlg;
            mbi.nToolBarId = IDR_Flipper_SET_MENUBAR;
			mbi.hInstRes = CDateTime::g_hInstance;
            mbi.nBmpId = 0;
            mbi.cBmpImages = 0;    

            SHCreateMenuBar(&mbi);

			SetFocus(hwndTimeZone);

            return 0;
        }
        break;
        case WM_COMMAND: 
			{
				switch (LOWORD(wParam))
				{
					case IDM_Flipper_SET_ACCEPT :
					case IDOK:
						{
							WCHAR wzName[MAX_PATH];
							DWORD dwName = ARRAYSIZE(wzName);

							int index = ComboBox_GetCurSel(hwndTimeZone);
							DWORD dwTimeZone = ComboBox_GetItemData(hwndTimeZone, index);
							
							RegistrySetDWORD(g_hKey, NULL, REG_TimeOffset, dwTimeZone);

							EndDialog(hwndDlg, IDOK);
						}
						break;
					case IDM_Flipper_SET_CANCEL:
						{
							EndDialog(hwndDlg, IDOK);
						}
						break;
				}
            }
            break;
        case WM_DESTROY:
            {
                Sleep(0);
            }
            break;
    } 
    return FALSE; 
}
コード例 #5
0
ファイル: FlipperSetup.cpp プロジェクト: nbclark/flipper
codeINSTALL_INIT Install_Init(
    HWND        hwndParent,
    BOOL        fFirstCall, 
    BOOL        fPreviouslyInstalled,
    LPCTSTR     pszInstallDir
    )
{
	DWORD dwDisp;

	HKEY hKeyFlipper, hKeyItems, hKeyItems0, hKeyItems1, hKeyItems0Data, hKeyItems1Data;
	RegCreateKeyEx(HKEY_CURRENT_USER, L"ControlPanel\\Flipper", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKeyFlipper, &dwDisp);

	RegistrySetDWORD(hKeyFlipper, NULL, REG_EnableScrollAnimation, 1);
	RegistrySetDWORD(hKeyFlipper, NULL, REG_AutoClose, 0);
	RegistrySetDWORD(hKeyFlipper, NULL, REG_Disabled, 0);
	RegistrySetDWORD(hKeyFlipper, NULL, REG_TabAlignment, 0);
	RegistrySetDWORD(hKeyFlipper, NULL, REG_TabSize, 1);

	RegCreateKeyEx(hKeyFlipper, L"Items", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKeyItems, &dwDisp);
	RegCreateKeyEx(hKeyItems, L"0", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKeyItems0, &dwDisp);
	RegCreateKeyEx(hKeyItems, L"1", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKeyItems1, &dwDisp);
	RegCreateKeyEx(hKeyItems0, L"Data", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKeyItems0Data, &dwDisp);
	RegCreateKeyEx(hKeyItems1, L"Data", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKeyItems1Data, &dwDisp);
	
	RegistrySetDWORD(hKeyItems0, NULL, L"Color", 8388672);
	RegistrySetDWORD(hKeyItems0, NULL, L"PluginId", 3);
	RegistrySetString(hKeyItems0, NULL, L"Assembly", L"FlipperPlugins.dll");
	RegistrySetString(hKeyItems0, NULL, L"Name", L"Quick Launch");
	
	RegistrySetDWORD(hKeyItems1, NULL, L"Color", 16512);
	RegistrySetDWORD(hKeyItems1, NULL, L"PluginId", 4);
	RegistrySetString(hKeyItems1, NULL, L"Assembly", L"FlipperPlugins.dll");
	RegistrySetString(hKeyItems1, NULL, L"Name", L"Weather");

	RegistrySetString(hKeyItems0Data, NULL, L"0_Path", L"\\Windows\\Start Menu\\Programs\\Flipper\\Flipper Settings.lnk");
	RegistrySetDWORD(hKeyItems0Data, NULL, L"Count", 1);

	RegistrySetDWORD(hKeyItems1Data, NULL, L"ZipCode", 98052);

	RegCloseKey(hKeyItems0Data);
	RegCloseKey(hKeyItems1Data);
	RegCloseKey(hKeyItems0);
	RegCloseKey(hKeyItems1);
	RegCloseKey(hKeyItems);
	RegCloseKey(hKeyFlipper);

    return codeINSTALL_INIT_CONTINUE;
}