48#define INVALID_RUNCMD_RETURN -1
67 memset(&si, 0,
sizeof(si));
83 TRACE(
"Successfully ran command\n");
106 WARN(
"Return code: %u\n", dwWait);
141 DWORD i, cbMaxCmdLine = 0, cchMaxValue = 0;
146 TRACE(
"processing %ls entries under HKLM\n", szKeyName);
148 TRACE(
"processing %ls entries under HKCU\n", szKeyName);
151 L"Software\\Microsoft\\Windows\\CurrentVersion",
157 TRACE(
"RegOpenKeyW failed on Software\\Microsoft\\Windows\\CurrentVersion (%ld)\n",
res);
171 TRACE(
"Key doesn't exist - nothing to be done\n");
176 TRACE(
"RegOpenKeyExW failed on run key (%ld)\n",
res);
195 TRACE(
"Couldn't query key info (%ld)\n",
res);
202 TRACE(
"No commands to execute.\n");
211 if (szCmdLine ==
NULL)
213 TRACE(
"Couldn't allocate memory for the commands to be executed\n");
222 cchMaxValue *
sizeof(*szValue));
225 TRACE(
"Couldn't allocate memory for the value names\n");
234 DWORD cchValLength = cchMaxValue, cbDataLength = cbMaxCmdLine;
249 TRACE(
"Couldn't read in value %lu - %ld\n",
i,
res);
259 TRACE(
"Couldn't delete value - %lu, %ld. Running command anyways.\n",
i,
res);
264 TRACE(
"Incorrect type of value #%lu (%lu)\n",
i,
type);
278 if (szCmdLineExp ==
NULL)
280 TRACE(
"Couldn't allocate memory for the commands to be executed\n");
296 if (szCmdLineExp !=
NULL)
302 TRACE(
"Done processing cmd #%lu\n",
i);
309 if (szCmdLine !=
NULL)
332 WCHAR cmdLine[] =
L"rundll32 iernonce.dll RunOnceExProcess";
336 L"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx",
342 TRACE(
"RegOpenKeyW failed on Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx (%ld)\n",
res);
361 TRACE(
"RegQueryInfoKeyW failed on Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx (%ld)\n",
res);
365 if (dwSubKeyCnt != 0)
375 if (hkRunOnceEx !=
NULL)
392 TRACE(
"(%d)\n", nCSIDL_Folder);
397 if (!
SUCCEEDED(hResult) || cchPathLen == 0)
418 if (
wcscmp(FoundData.cFileName,
L".") == 0 ||
419 wcscmp(FoundData.cFileName,
L"..") == 0)
443 ExecInfo.
cbSize =
sizeof(ExecInfo);
483 if (
res && bNormalBoot)
508 TRACE(
"Operation done\n");
510 return res ? 0 : 101;
538 TRACE(
"dwWait: 0x%08lX\n", dwWait);
554 const DWORD dwWaitTotal = 3000;
VOID TrayProcessMessages(IN OUT ITrayWindow *Tray)
static VOID DoFinishStartupItems()
static INT ProcessStartupItems()
#define RegCloseKey(hKey)
#define ERROR_NOT_ENOUGH_MEMORY
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
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 RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
DWORD WINAPI GetTickCount(VOID)
BOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
GLuint GLuint GLsizei GLenum type
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ERROR_FILE_NOT_FOUND
#define FILE_ATTRIBUTE_HIDDEN
#define REG_OPENED_EXISTING_KEY
#define REG_OPTION_VOLATILE
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HRESULT WINAPI SHCreateSessionKey(REGSAM samDesired, PHKEY phKey)
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
BOOL WINAPI IsUserAnAdmin(void)
#define CSIDL_COMMON_STARTUP
@ REST_NOCURRENTUSERRUNONCE
@ REST_NOLOCALMACHINERUNONCE
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
static int runCmd(LPWSTR cmdline, LPCWSTR dir, BOOL wait, BOOL minimized)
static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete, BOOL bSynchronous)
static BOOL InitializeStartupMutex()
#define INVALID_RUNCMD_RETURN
static BOOL ProcessRunOnceEx(HKEY hkRoot)
VOID ReleaseStartupMutex()
VOID ProcessRunOnceItems()
static BOOL AutoStartupApplications(INT nCSIDL_Folder)
static HANDLE s_hStartupMutex
BOOL DoStartStartupItems(ITrayWindow *Tray)
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
HWND WINAPI GetShellWindow(VOID)
DWORD WINAPI GetLastError(void)
#define STARTF_USESHOWWINDOW
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER
BOOL WINAPI TranslateMessage(_In_ const MSG *)
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
int WINAPI GetSystemMetrics(_In_ int)