12#define WIN32_NO_STATUS
28#define MAX_VALUE_NAME 16383
35#define RUNDLL(param) \
36 ((INT_PTR)ShellExecuteW(NULL, L"open", L"rundll32.exe", (param), NULL, SW_SHOWDEFAULT) > 32)
45 if (*Arg ==
'/' || *Arg ==
'-')
58 IOpenControlPanel *pOCP;
60 &IID_IOpenControlPanel, (
void**)&pOCP);
64 IOpenControlPanel_Release(pOCP);
81 StringCbCopyW(szParameters,
sizeof(szParameters),
L"/n,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}");
82 StringCbCatW(szParameters,
sizeof(szParameters), lpFolderCLSID);
100 return RUNDLL(szParameters);
115 if (*lpCmdLine == 0 || !
_wcsicmp(lpCmdLine,
L"panel"))
119 if (!
_wcsicmp(lpCmdLine,
L"sticpl.cpl")) lpCmdLine = (
LPWSTR)
L"scannercamera";
126 else if (!
_wcsicmp(lpCmdLine,
L"folders"))
return RUNDLL(
L"shell32.dll,Options_RunDLL");
140 else if (!
_wcsicmp(lpCmdLine,
L"userpasswords2"))
return RUNDLL(
L"netplwiz.dll,UsersRunDll");
153 pszPage =
argv[argi + 3];
166 L"Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls",
173 for (dwIndex = 0; ; ++dwIndex)
193 if (!
_wcsicmp(lpCmdLine, szValueName))
202 dwDataSize + 2 *
sizeof(
WCHAR));
219 if (*pszData !=
L'\"')
221 *(--pszData) =
L'\"';
222 pszData[dwDataSize /
sizeof(
WCHAR)] =
L'\"';
223 pszData[(dwDataSize /
sizeof(
WCHAR)) + 1] = 0;
static BOOL IsSwitch(LPCWSTR Switch, LPCWSTR Arg)
static HRESULT OpenControlPanelItem(LPCWSTR Name, LPCWSTR Page)
static INT OpenShellFolder(LPWSTR lpFolderCLSID)
static INT RunControlPanel(LPCWSTR lpCmd)
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
VOID WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow)
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define HeapFree(x, y, z)
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
HWND WINAPI GetShellWindow(VOID)
#define HKEY_LOCAL_MACHINE