Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

288 lines
6.6 KiB

  1. #ifndef GLOBALS_H
  2. #define GLOBALS_H
  3. //Use alpha to build axp version. can use w/ internal or sb flags.
  4. //use sb or internal to build those specific versions. Default is external.
  5. //#define INTERNAL
  6. //#define SB
  7. //#define ALPHA
  8. #define NOCHKUPGRD
  9. #include <windows.h>
  10. #include <dbt.h>
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include <process.h>
  14. #include "cfgmgr32.h"
  15. #include <objbase.h>
  16. #include <objidl.h>
  17. #include <shlobj.h>
  18. #include <setupapi.h>
  19. #include <tchar.h>
  20. //#include <e:\root\dev\inc16\setupx.h>
  21. //#define BRYANPARSE
  22. //#define NOCREDE
  23. //#define LOWORD(l) ((WORD) (l))
  24. #define ENUM_SUCCESS 0
  25. #define ENUM_SIBLINGFAILURE 1
  26. #define ENUM_CHILDFAILURE 2
  27. #define ENUM_POSTFAILURE 3
  28. #define ENUM_GENFAILURE 4
  29. #define PLATFORM_9X 0
  30. #define PLATFORM_NT4 1
  31. #define PLATFORM_NT5 2
  32. #define REG_SUCCESS TRUE
  33. #define REG_FAILURE FALSE
  34. #define SYSP_MAX_STR_LEN 1024
  35. //#define szLogFile "c:\\windows\\desktop\\logger.csv"
  36. BOOL LogString(char *szFile, char *szString, ...);
  37. void DebugOutf(char *szFormat, ...);
  38. int EnumerateDevices(DEVNODE dnDevNodeTraverse, int j, DEVNODE dnParentNode);
  39. DWORD EnumerateClasses(ULONG ulIndex);
  40. HRESULT ResolveIt(HWND hwnd, LPCSTR lpszLinkFile, LPSTR lpszPath);
  41. DWORD GetClassDevs(CHAR *szClassName);
  42. extern BOOL g_WalkStartMenu;
  43. //BOOL WalkStartMenu;
  44. //TCHAR g_WindowsDirectory[];
  45. //HWND g_MainWindow;
  46. class kLogFile
  47. {
  48. public:
  49. BOOL LogString(TCHAR *szString, ...);
  50. BOOL InitFile(TCHAR *szTempFile, TCHAR* szTempDir);
  51. kLogFile();
  52. ~kLogFile();
  53. TCHAR *szFile;
  54. BOOL StripCommas(TCHAR *szString);
  55. void ValidateString(PTCHAR pString, int dwLen);
  56. TCHAR *szLogDir;
  57. private:
  58. };
  59. class kWin9xDevWalk
  60. {
  61. public:
  62. int Go();
  63. kLogFile *LogProc;
  64. kWin9xDevWalk(kLogFile *Proc);
  65. BOOL LoadResourceFile(PSTR FilePath,PSTR ResName);
  66. void AppendToLogFile(PTCHAR szFile);
  67. ~kWin9xDevWalk();
  68. private:
  69. };
  70. class kNT5DevWalk
  71. {
  72. public:
  73. int Go();
  74. kLogFile *LogProc;
  75. kNT5DevWalk(kLogFile *Proc);
  76. BOOL LoadResourceFile(PSTR FilePath,PSTR ResName);
  77. void AppendToLogFile(PTCHAR szFile);
  78. ~kNT5DevWalk();
  79. private:
  80. };
  81. /*
  82. class kWin9xAppWalk
  83. {
  84. public:
  85. WORD wStartMenuLen;
  86. DWORD dwCurrentKey;
  87. HKEY hkeyRoot;
  88. BOOL bRegStat;
  89. char szRootKeyString[1024];
  90. BOOL Begin(WORD dwPlatform);
  91. BOOL NextKey(WORD wPlatform);
  92. BOOL Walk(WORD wPlatform);
  93. BOOL GetUninstallValues(WORD wPlatform, char* szName);
  94. kWin9xAppWalk(kLogFile *Proc, HWND hIn);
  95. kLogFile *LogProc;
  96. HWND hMainWnd;
  97. BOOL WalkDir(char *szTempPath, char *szFile);
  98. BOOL WalkStartMenu();
  99. HRESULT ResolveIt(LPCSTR lpszLinkFile, LPSTR lpszPath);
  100. BOOL EndsInLnk(char *szFile);
  101. void GetAppVer(LPSTR pszAppName);
  102. private:
  103. };
  104. */
  105. class kNT5AppWalk
  106. {
  107. public:
  108. WORD wStartMenuLen;
  109. DWORD dwCurrentKey;
  110. HKEY hkeyRoot;
  111. BOOL bRegStat;
  112. char szRootKeyString[1024];
  113. BOOL Begin();
  114. BOOL NextKey();
  115. BOOL Walk();
  116. BOOL GetUninstallValues(char* szName);
  117. kNT5AppWalk(kLogFile *Proc, HWND hIn);
  118. kLogFile *LogProc;
  119. HWND hMainWnd;
  120. BOOL WalkDir(char *szTempPath, char *szFile);
  121. BOOL WalkStartMenu();
  122. HRESULT ResolveIt(LPCSTR lpszLinkFile, LPSTR lpszPath);
  123. BOOL EndsInLnk(char *szFile);
  124. void GetAppVer(LPSTR pszAppName);
  125. // BOOL GetNetStrings();
  126. private:
  127. };
  128. class kNT5NetWalk
  129. {
  130. public:
  131. WORD wStartMenuLen;
  132. DWORD dwCurrentKey;
  133. DWORD dwLevel2Key;
  134. HKEY hkeyRoot;
  135. char szRootKeyString[1024];
  136. kLogFile *LogProc;
  137. HWND hMainWnd;
  138. kNT5NetWalk(kLogFile *Proc, HWND hIn);
  139. BOOL Begin();
  140. BOOL Walk();
  141. BOOL SearchSubKeys(char *szName);
  142. BOOL GetKeyValues(char* szName);
  143. private:
  144. };
  145. class kNT4DevWalk
  146. {
  147. public:
  148. WORD wStartMenuLen;
  149. DWORD dwCurrentKey;
  150. DWORD dwLevel2Key;
  151. HKEY hkeyRoot;
  152. char szRootKeyString[1024];
  153. kLogFile *LogProc;
  154. HWND hMainWnd;
  155. kNT4DevWalk(kLogFile *Proc, HWND hIn);
  156. BOOL Begin();
  157. BOOL Walk();
  158. BOOL SearchSubKeys(char *szName);
  159. BOOL GetKeyValues(char* szName);
  160. private:
  161. };
  162. typedef UINT (CALLBACK* LPFNDLLFUNC1)(LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
  163. typedef UINT (CALLBACK* LPFNDLLFUNC2)(LPTSTR, UINT);
  164. class CLASS_GeneralAppWalk
  165. {
  166. public:
  167. BOOL OpenRegistry(void);
  168. BOOL GetUninstallValues(TCHAR *KeyName);
  169. BOOL NextKey(void);
  170. BOOL Walk(void);
  171. CLASS_GeneralAppWalk(kLogFile *LogProc, HWND hIn);
  172. BOOL WalkStartMenu(void);
  173. BOOL WalkDir(TCHAR *TempPath, TCHAR *File);
  174. BOOL EndsInLnk(TCHAR *File);
  175. HRESULT ResolveIt(LPCSTR LinkFile, LPSTR Path);
  176. BOOL GetAppVer(LPSTR AppName);
  177. BOOL GetCurrentWinDir(void);
  178. TCHAR g_WindowsDirectory[MAX_PATH];
  179. private:
  180. HKEY HandleToUninstallKeyRoot;
  181. kLogFile *LogProc;
  182. HWND gHandleToMainWindow;
  183. DWORD CurrentKey;
  184. TCHAR RootKeyString[1024];
  185. WORD StartMenuLen;
  186. };
  187. typedef enum {
  188. Win95,
  189. Win98,
  190. NT4,
  191. Win2000,
  192. Whistler,
  193. Unknown
  194. } ENUM_OS_VERSION;
  195. class CLASS_GeneralInfo
  196. {
  197. public:
  198. CLASS_GeneralInfo(kLogFile *LogProc, HWND hIn);
  199. void GetCurrentWindowsDirectory(void);
  200. void DetermineOS(void);
  201. BOOL InitLogFile(void);
  202. BOOL FillInArguments(void);
  203. BOOL DetermineArgumentValidity(void);
  204. void WriteVersions(void);
  205. void DetermineCommandLine(void);
  206. BOOL CopyInput(void);
  207. void GetUUID(void);
  208. void WriteArguments(void);
  209. void WriteFreeDiskSpace(void);
  210. void WriteVolumeType(void);
  211. void WriteMemorySize(void);
  212. void WriteOSVersion(void);
  213. /*
  214. WriteDevices
  215. WriteApps
  216. */
  217. void InitHelpers(void);
  218. void AbuseOtherApps(void);
  219. BOOL Go(void);
  220. void ChangeSpaces(TCHAR *Input);
  221. BOOL ReadInFileInfo(TCHAR *FileName);
  222. void WriteGeneralInfo(void);
  223. BOOL AutoRun;
  224. BOOL RunMinimized;
  225. private:
  226. HWND gHandleToMainWindow;
  227. kLogFile *LogProc;
  228. TCHAR WindowsDirectory[MAX_PATH]; //no trailing "\"
  229. ENUM_OS_VERSION OSVersion;
  230. TCHAR Corporation[1024];
  231. TCHAR Email[1024];
  232. TCHAR Manufacturer[1024];
  233. TCHAR Model[1024];
  234. TCHAR NumComp[1024];
  235. TCHAR SiteID[1024];
  236. WORD SiteIDIndex;
  237. TCHAR Profile[1024];
  238. TCHAR BetaID[1024];
  239. TCHAR MachineType[1024];
  240. WORD MachineTypeIndex;
  241. TCHAR OriginalMachineUUID[1024];
  242. TCHAR szRegFile[1024];
  243. TCHAR PlatformExtension[12];
  244. BOOL RunChkupgrd;
  245. BOOL RunDevdump;
  246. void CatLogFile(TCHAR *szFile);
  247. BOOL LoadResourceFile(PSTR FilePath,PSTR ResName);
  248. BOOL OverWrite;
  249. BOOL UseComputerName;
  250. };
  251. #endif //GLOBALS_H