1 #define WIN32_NO_STATUS 2 #define WIN32_LEAN_AND_MEAN 3 #include <windows.h> 4 #include <tchar.h> 5 #include <shellapi.h> 6 #include <shlwapi.h> 7 8 #define REGEDIT _T("regedit.exe") 9 10 int 11 WINAPI 12 _tWinMain(HINSTANCE hCurInst, 13 HINSTANCE hPrevInst, 14 LPTSTR lpsCmdLine, 15 int nCmdShow) 16 { 17 TCHAR szPath[MAX_PATH]; 18 19 if(GetWindowsDirectory(szPath, MAX_PATH)) 20 { 21 PathAppend(szPath, REGEDIT); 22 ShellExecute(NULL, 23 NULL, 24 szPath, 25 lpsCmdLine, 26 NULL, 27 nCmdShow); 28 } 29 else 30 { 31 ShellExecute(NULL, 32 NULL, 33 REGEDIT, 34 lpsCmdLine, 35 NULL, 36 nCmdShow); 37 } 38 39 return 0; 40 } 41