Leaked source code of windows server 2003
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.

707 lines
27 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: clmt.h
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * Cross Language Migration Tool, main header file
  7. *
  8. \***************************************************************************/
  9. #ifndef CLMT_H
  10. #define CLMT_H
  11. #include <nt.h>
  12. #include <ntrtl.h>
  13. #include <nturtl.h>
  14. #include <ntlsa.h>
  15. #include <windows.h>
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <userenv.h>
  19. #include <userenvp.h>
  20. #include <setupapi.h>
  21. #include <regstr.h>
  22. #include <shlwapi.h>
  23. #include <shlobj.h>
  24. #include <shlobjp.h>
  25. #include <string.h>
  26. #include <Sddl.h>
  27. #include <assert.h>
  28. #include <tchar.h>
  29. #include <lm.h>
  30. #include <resource.h>
  31. #include <locale.h>
  32. #include <iadmw.h>
  33. #include <sfcapip.h>
  34. #include <Aclapi.h>
  35. #include <aclui.h>
  36. #ifndef NOT_USE_SAFE_STRING
  37. #define STRSAFE_LIB
  38. #include <strsafe.h>
  39. #endif
  40. typedef struct _REG_STRING_REPLACE {
  41. DWORD nNumOfElem;
  42. DWORD cchUserName;
  43. LPTSTR szUserNameLst;
  44. DWORD cchSearchString;
  45. LPTSTR lpSearchString; //Orignal Multi-String
  46. DWORD cchReplaceString;
  47. LPTSTR lpReplaceString; //Replaced Multi-String
  48. DWORD cchAttribList; //String Attribute
  49. LPDWORD lpAttrib; //String Attribute
  50. DWORD cchFullStringList;
  51. LPTSTR lpFullStringList;
  52. DWORD cchMaxStrLen; //Max String Length in search and replac strings
  53. } REG_STRING_REPLACE, *PREG_STRING_REPLACE;
  54. typedef struct value_list {
  55. VALENT ve;
  56. METADATA_RECORD md;
  57. LPTSTR lpPre_valuename;
  58. DWORD val_type;
  59. DWORD val_attrib;
  60. struct value_list *pvl_next;
  61. } VALLIST, *PVALLIST;
  62. typedef struct str_list {
  63. LPTSTR lpstr;
  64. struct str_list *pst_prev;
  65. struct str_list *pst_next;
  66. } STRLIST, *PSTRLIST;
  67. //struc used for folder renaming
  68. typedef struct {
  69. int id; // CSIDL_ value
  70. LPCTSTR pszIdInString;
  71. int idsDefault; // string id of default folder name name
  72. LPCTSTR pszValueName; // reg key (not localized)
  73. } FOLDER_INFO;
  74. typedef struct _PROFILE {
  75. DWORD dwFlags;
  76. DWORD dwInternalFlags;
  77. DWORD dwUserPreference;
  78. HANDLE hTokenUser;
  79. HANDLE hTokenClient;
  80. LPTSTR lpUserName;
  81. LPTSTR lpProfilePath;
  82. LPTSTR lpRoamingProfile;
  83. LPTSTR lpDefaultProfile;
  84. LPTSTR lpLocalProfile;
  85. LPTSTR lpPolicyPath;
  86. LPTSTR lpServerName;
  87. HKEY hKeyCurrentUser;
  88. FILETIME ftProfileLoad;
  89. FILETIME ftProfileUnload;
  90. LPTSTR lpExclusionList;
  91. } USERPROFILE, *LPPROFILE;
  92. // Structure of translation table to map <root key string> to <HKEY value>
  93. typedef struct _STRING_TO_DATA {
  94. TCHAR String[MAX_PATH];
  95. HKEY Data;
  96. } STRING_TO_DATA, *PSTRING_TO_DATA;
  97. typedef struct _DENIED_ACE_LIST {
  98. DWORD dwAclSize;
  99. ACCESS_DENIED_ACE *pace;
  100. LPTSTR lpObjectName;
  101. struct _DENIED_ACE_LIST *previous;
  102. struct _DENIED_ACE_LIST *next;
  103. } DENIED_ACE_LIST, *LPDENIED_ACE_LIST;
  104. //our main version is 1.0 and then followed by build number(Major/Minor)
  105. //used in res.rc
  106. #define VER_FILEVERSION 1,0,50,01
  107. #define VER_FILEVERSION_STR "1.0.0050.1"
  108. //used in INF file to specify the file/folder move type
  109. #define TYPE_DIR_MOVE 0 //move a folder
  110. #define TYPE_FILE_MOVE 1 //move a file
  111. #define TYPE_SFPFILE_MOVE 2 //move a file which is system protected
  112. //used in INF file to specify registry rename type
  113. #define TYPE_VALUE_RENAME 0 //rename registry data renaming
  114. #define TYPE_VALUENAME_RENAME 1 //rename registry name renaming
  115. #define TYPE_KEY_RENAME 2 //rename registry key renaming
  116. #define TYPE_SERVICE_MOVE 3 //rename a service name
  117. //our inf file name
  118. #define CLMTINFFILE TEXT("clmt.inf")
  119. //section name in the inf file listed user/group account we need to rename
  120. #define USERGRPSECTION TEXT("UserGrp.ObjectRename")
  121. //string buffer size for multisz string
  122. #define MULTI_SZ_BUF_DELTA 3*1024
  123. #define DWORD_BUF_DELTA 1024
  124. //following are section (or part of) constants
  125. #define SHELL_FOLDER_PREFIX TEXT("ShellFolder.")
  126. #define SHELL_FOLDER_REGISTRY TEXT("Registry")
  127. #define SHELL_FOLDER_FOLDER TEXT("Folder")
  128. #define SHELL_FOLDER_LONGPATH_TEMPLATE TEXT("LongPathNameTemplate")
  129. #define SHELL_FOLDER_SHORTPATH_TEMPLATE TEXT("ShortPathNameTemplate")
  130. // registry value name for
  131. // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
  132. #define PROFILES_DIRECTORY TEXT("ProfilesDirectory")
  133. #define DEFAULT_USER TEXT("Default User")
  134. //out backup direcory name(located in %windir%\$CLMT_BACKUP$
  135. //used for saving files that we need to delete and also the INF file
  136. #define CLMT_BACKUP_DIR TEXT("$CLMT_BACKUP$")
  137. //registry key for we created for saving our tools running status
  138. //it's in HKEY_LOCAL_MACHINE\SYSTEM\System\CrossLanguageMigration
  139. #define CLMT_REGROOT TEXT("System\\CrossLanguageMigration")
  140. #define CLMT_RUNNING_STATUS TEXT("InProgress")
  141. #define CLMT_OriginalInstallLocale TEXT("OriginalInstallLocale")
  142. //Flag used to specify what the current running status
  143. #define CLMT_DOMIG 0x01 // we are doing migration
  144. #define CLMT_UNDO_PROGRAM_FILES 0x02 // we are undoing %programfiles% changes
  145. #define CLMT_UNDO_APPLICATION_DATA 0x04 // we are undoing %userprofile%application data changes
  146. #define CLMT_UNDO_ALL 0x08 // we are undoing what we changed
  147. #define CLMT_CURE_PROGRAM_FILES 0x10 // create symbolic link between english and localized folder
  148. // for those folder that will affect functionality(eg.%programfiles%)
  149. #define CLMT_REMINDER 0x20 // reminder user to convert to NTFS....
  150. #define CLMT_CLEANUP_AFTER_UPGRADE 0x40 // cleaning up the machine after upgrade to .NET
  151. #define CLMT_CURE_ALL 0x80 // create symbolic link between english and localized folder for all folders we changed
  152. #define CLMT_CURE_AND_CLEANUP 0x100 // This to enable /CURE and /FINAL to run independently on machine with FAT
  153. #define CLMT_DOMIG_DONE (0xFF00 | CLMT_DOMIG) // migration is done
  154. #define CLMT_UNDO_PROGRAM_FILES_DONE (0xFF00 | CLMT_UNDO_PROGRAM_FILES) //undoing %programfiles%
  155. #define CLMT_UNDO_APPLICATION_DATA_DONE (0xFF00 | CLMT_UNDO_APPLICATION_DATA) //undoing %userprofile%application data is done
  156. #define CLMT_UNDO_ALL_DONE (0xFF00 | CLMT_UNDO_ALL)//undoing what we changed is done
  157. // Constants used to keep track of machine state
  158. #define CLMT_STATE_ORIGINAL 1 // Original Win2K machine
  159. #define CLMT_STATE_PROGRAMFILES_UNDONE 10 // CLMT'ed machine is undone the program files operation
  160. #define CLMT_STATE_APPDATA_UNDONE 11 // CLMT'ed machine is undone the application data operation
  161. #define CLMT_STATE_MIGRATION_DONE 100 // Machine has been CLMT'ed
  162. #define CLMT_STATE_UPGRADE_DONE 200 // CLMT'ed machine has been Upgraded to .NET
  163. #define CLMT_STATE_PROGRAMFILES_CURED 400 // Machine has been CLMT'ed and Hardlink is created
  164. #define CLMT_STATE_FINISH 800 // .NET machine has been cleaned up by CLMT
  165. // Constants used to identify status of CLM tool
  166. #define CLMT_STATUS_ANALYZING_SYSTEM 0
  167. #define CLMT_STATUS_MODIFYING_SYSTEM 1
  168. // Constants used by lstrXXX functions
  169. #define LSTR_EQUAL 0
  170. // Calcalate array size (in number of elements)
  171. #define ARRAYSIZE(s) (sizeof(s) / (sizeof(s[0])))
  172. // Macro used by CompareString() API
  173. #define LOCALE_ENGLISH MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
  174. // Macros for heap memory management
  175. #define MEMALLOC(cb) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb)
  176. #define MEMFREE(pv) HeapFree(GetProcessHeap(), 0, pv);
  177. #define MEMREALLOC(pv, cb) HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pv, cb)
  178. // Locale ID constants
  179. #define LCID_SWEDISH 0x041d
  180. #define LCID_PORTUGUESE_BRAZILIAN 0x0416
  181. #define LCID_PORTUGUESE_STANDARD 0x0816
  182. #define LCID_HUNGARIAN 0x040e
  183. #define LCID_CZECH 0x0405
  184. #define LCID_TURKISH 0x041f
  185. //Private CSIDL used in shell folder renaming
  186. #define CSIDL_LOCAL_SETTINGS 0x7f
  187. #define CSIDL_COMMON_ACCESSORIES 0x7e
  188. #define CSIDL_ACCESSORIES 0x7d
  189. #define CSIDL_USER_PROFILE 0x7c
  190. #define CSIDL_PROFILES_DIRECTORY 0x7b
  191. #define CSIDL_PF_ACCESSORIES 0x7a
  192. #define CSIDL_COMMON_ACCESSORIES_ACCESSIBILITY 0x79
  193. #define CSIDL_COMMON_ACCESSORIES_ENTERTAINMENT 0x78
  194. #define CSIDL_COMMON_ACCESSORIES_SYSTEM_TOOLS 0x77
  195. #define CSIDL_COMMON_ACCESSORIES_COMMUNICATIONS 0x76
  196. #define CSIDL_COMMON_ACCESSORIES_MS_SCRIPT_DEBUGGER 0x75
  197. #define CSIDL_COMMON_WINDOWSMEDIA 0x74
  198. #define CSIDL_COMMON_COVERPAGES 0x73
  199. #define CSIDL_COMMON_RECEIVED_FAX 0x72
  200. #define CSIDL_COMMON_SENT_FAX 0x71
  201. #define CSIDL_COMMON_FAX 0x70
  202. #define CSIDL_FAVORITES_LINKS 0x6e
  203. #define CSIDL_FAVORITES_MEDIA 0x6d
  204. #define CSIDL_ACCESSORIES_ACCESSIBILITY 0x6c
  205. #define CSIDL_ACCESSORIES_SYSTEM_TOOLS 0x6b
  206. #define CSIDL_ACCESSORIES_ENTERTAINMENT 0x6a
  207. #define CSIDL_ACCESSORIES_COMMUNICATIONS 0x69
  208. #define CSIDL_ACCESSORIES_COMMUNICATIONS_HYPERTERMINAL 0x68
  209. #define CSIDL_COMMON_ACCESSORIES_GAMES 0x67
  210. #define CSIDL_QUICKLAUNCH 0x66
  211. #define CSIDL_COMMON_COMMONPROGRAMFILES_SERVICES 0x65
  212. #define CSIDL_COMMON_PROGRAMFILES_ACCESSARIES 0x64
  213. #define CSIDL_COMMON_PROGRAMFILES_WINNT_ACCESSARIES 0x63
  214. #define CSIDL_USERNAME_IN_USERPROFILE 0x62
  215. #define CSIDL_UAM_VOLUME 0x61
  216. #define CSIDL_COMMON_SHAREDTOOLS_STATIONERY 0x60
  217. #define CSIDL_NETMEETING_RECEIVED_FILES 0x5f
  218. #define CSIDL_COMMON_NETMEETING_RECEIVED_FILES 0x5e
  219. #define CSIDL_COMMON_ACCESSORIES_COMMUNICATIONS_FAX 0x5d
  220. #define CSIDL_FAX_PERSONAL_COVER_PAGES 0x5c
  221. #define CSIDL_FAX 0x5b
  222. #define USER_SHELL_FOLDER TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders")
  223. #define c_szDot TEXT(".")
  224. #define c_szDotDot TEXT("..")
  225. #define c_szStarDotStar TEXT("*.*")
  226. #define TEXT_WINSTATION_KEY TEXT("SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations")
  227. #define TEXT_RUN_KEY TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
  228. #define TEXT_CLMT_RUN_VALUE TEXT("CLMT")
  229. //Type specify registr change used in regfind.c and ReplaceValueSettings in utils.c
  230. #define REG_CHANGE_VALUENAME 1
  231. #define REG_CHANGE_VALUEDATA 2
  232. #define REG_CHANGE_KEYNAME 4
  233. #define MAXDOMAINLENGTH MAX_PATH
  234. #define CONSTANT_REG_VALUE_DATA_RENAME 0 //indicates Registry Value Data Rename
  235. #define CONSTANT_REG_VALUE_NAME_RENAME 1 //indicates Registry Value Name Rename
  236. #define CONSTANT_REG_KEY_RENAME 2 //indicates Registry Key Rename
  237. #define REG_PERSYS_UPDATE TEXT("REG.Update.Sys")
  238. #define REG_PERUSER_UPDATE_PREFIX TEXT("REG.Update.")
  239. #define APPLICATION_DATA_METABASE TEXT("$MetaBase")
  240. #define PROFILE_PATH_READ 0
  241. #define PROFILE_PATH_WRITE 1
  242. #define DS_OBJ_PROPERTY_UPDATE TEXT("DS_OBJ_PROPERTY_UPDATE")
  243. #define FOLDER_CREATE_HARDLINK TEXT("Folder.HardLink")
  244. #define FOLDER_UPDATE_HARDLINK TEXT("Folder.HardLink.UPDATE")
  245. #define TEXT_SERVICE_STATUS_SECTION TEXT("Services.ConfigureStatus")
  246. #define TEXT_SERVICE_STATUS_CLEANUP_SECTION TEXT("Services.ConfigureStatus.Cleanup")
  247. #define TEXT_SERVICE_STARTUP_SECTION TEXT("Services.ConfigureStartupType")
  248. #define TEXT_SERVICE_STARTUP_CLEANUP_SECTION TEXT("Services.ConfigureStartupType.Cleanup")
  249. #ifdef __cplusplus
  250. extern "C" {
  251. #endif
  252. //global variables declartion, see detail in globals.c
  253. extern HINSTANCE ghInst;
  254. extern TCHAR g_szToDoINFFileName[MAX_PATH];
  255. extern DWORD g_dwKeyIndex;
  256. extern HINF g_hInfDoItem;
  257. extern FOLDER_INFO c_rgFolderInfo[];
  258. extern REG_STRING_REPLACE g_StrReplaceTable,g_StrReplaceTablePerUser;
  259. extern BOOL g_bBeforeMig;
  260. extern DWORD g_dwRunningStatus;
  261. extern BOOL g_fRunWinnt32;
  262. extern BOOL g_fNoAppChk;
  263. extern BOOL g_fUseInf;
  264. extern TCHAR g_szInfFile[MAX_PATH];
  265. extern HINF g_hInf;
  266. extern HANDLE g_hMutex;
  267. extern HANDLE g_hInstance ;
  268. extern HANDLE g_hInstDll;
  269. extern TCHAR g_szChangeLog[MAX_PATH];
  270. extern DWORD g_dwIndex;
  271. extern LPDENIED_ACE_LIST g_DeniedACEList;
  272. //BUGBUG xiaoz
  273. static TCHAR g_cszProfileImagePath[] = TEXT("ProfileImagePath");
  274. static TCHAR g_cszProfileList[] = TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList");
  275. //
  276. //From regfind.c
  277. //
  278. HRESULT RegistryAnalyze(HKEY,LPTSTR,LPTSTR,PREG_STRING_REPLACE,LPTSTR,DWORD,LPTSTR,BOOL);
  279. //
  280. //From iis.cpp
  281. //
  282. HRESULT MetabaseAnalyze (LPTSTR,PREG_STRING_REPLACE,BOOL);
  283. HRESULT SetMetabaseValue (LPCTSTR, LPCTSTR, DWORD, LPCTSTR);
  284. HRESULT BatchUpateIISMetabase(HINF, LPTSTR);
  285. HRESULT MigrateMetabaseSettings(HINF);
  286. //
  287. // From Utils.c
  288. //
  289. HRESULT ConstructUIReplaceStringTable(LPTSTR, LPTSTR,PREG_STRING_REPLACE);
  290. HRESULT Sz2MultiSZ(IN OUT LPTSTR, IN TCHAR);
  291. HRESULT AddHardLinkEntry(LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPTSTR,LPTSTR);
  292. HRESULT GetSharePath(LPTSTR, LPTSTR, PDWORD);
  293. HRESULT FRSUpdate();
  294. HRESULT Ex2000Update();
  295. LONG SDBCleanup(OUT LPTSTR, IN DWORD, OUT LPBOOL);
  296. HRESULT SetProtectedRenamesFlag(BOOL);
  297. HRESULT DoCriticalWork ();
  298. HRESULT IsNTFS(IN LPTSTR, OUT BOOL*);
  299. HRESULT IsSysVolNTFS(OUT BOOL*);
  300. HRESULT CreateAdminsSd( PSECURITY_DESCRIPTOR*);
  301. int MyStrCmpIW(LPCWSTR, LPCWSTR );
  302. int MyStrCmpIA(LPCSTR, LPCSTR );
  303. #ifdef UNICODE
  304. #define MyStrCmpI MyStrCmpIW
  305. #else
  306. #define MyStrCmpI MyStrCmpIA
  307. #endif // !UNICODE
  308. HRESULT ReconfigureServiceStartType(IN LPCTSTR,IN DWORD,IN DWORD,IN DWORD) ;
  309. HRESULT AddExtraQuoteEtc(LPTSTR,LPTSTR*);
  310. HRESULT CopyMyselfTo(LPTSTR);
  311. HRESULT SetRunOnceValue (IN LPCTSTR,IN LPCTSTR);
  312. HRESULT SetRunValue(LPCTSTR, LPCTSTR);
  313. HRESULT LogMachineInfo();
  314. BOOL StopService(IN LPCTSTR pServiceName,IN DWORD dwMaxWait);
  315. HRESULT GetSIDFromName(IN LPTSTR,OUT PSID *);
  316. BOOL ConcatenatePaths (LPTSTR, LPCTSTR, UINT);
  317. UINT StrToUInt (LPTSTR);
  318. BOOL INIFile_ChangeSectionName (LPCTSTR, LPCTSTR, LPCTSTR);
  319. BOOL INIFile_IsSectionExist(LPCTSTR, LPCTSTR);
  320. void IntToString (DWORD, LPTSTR);
  321. UINT GetInstallLocale (VOID);
  322. BOOL IsDirExisting (LPTSTR);
  323. LONG IsDirExisting2(LPTSTR, PBOOL);
  324. BOOL IsFileFolderExisting (LPTSTR);
  325. BOOL RenameDirectory (LPTSTR, LPTSTR);
  326. HRESULT UpdateINFFilePerUser(LPCTSTR, LPCTSTR, LPCTSTR, BOOL);
  327. HRESULT UpdateINFFileSys(LPTSTR);
  328. HRESULT MyMoveDirectory(LPTSTR,LPTSTR,BOOL,BOOL,BOOL,DWORD);
  329. HRESULT GetInfFilePath(LPTSTR, SIZE_T);
  330. HRESULT GetInfFromResource(LPCTSTR);
  331. BOOL ReplaceString(LPCTSTR, LPCTSTR, LPCTSTR, LPTSTR, size_t, LPCTSTR, LPCTSTR, LPDWORD, BOOL);
  332. BOOL IsStrInMultiSz(LPCTSTR,LPCTSTR);
  333. BOOL MultiSzSubStr(LPTSTR,LPTSTR);
  334. DWORD MultiSzLen(LPCTSTR);
  335. LPCTSTR MultiSzTok(LPCTSTR);
  336. BOOL CmpMultiSzi(LPCTSTR,LPCTSTR);
  337. LPTSTR GetStrInMultiSZ(DWORD, LPCTSTR);
  338. DWORD StrNumInMultiSZ(LPCTSTR, LPCTSTR);
  339. HRESULT GetSetUserProfilePath(LPCTSTR,LPTSTR,size_t,UINT,UINT);
  340. void ReStartSystem(UINT);
  341. int DoMessageBox(HWND, UINT, UINT, UINT);
  342. HRESULT StringMultipleReplacement(LPCTSTR,LPCTSTR,LPCTSTR,LPTSTR,size_t);
  343. BOOL Str2KeyPath(LPTSTR,PHKEY,LPTSTR*);
  344. BOOL HKey2Str(HKEY, LPTSTR,size_t);
  345. HRESULT MyMoveFile(LPCTSTR, LPCTSTR, BOOL, BOOL);
  346. BOOL AppendSzToMultiSz(IN LPCTSTR,IN OUT LPTSTR *,IN OUT PDWORD);
  347. BOOL AddItemToStrRepaceTable(LPTSTR,LPTSTR,LPTSTR,LPTSTR,DWORD,PREG_STRING_REPLACE);
  348. void PrintMultiSz(LPTSTR);
  349. BOOL StringValidationCheck(LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR, LPDWORD, DWORD);
  350. BOOL ReverseStrCmp(LPCTSTR, LPCTSTR);
  351. BOOL ReplaceMultiMatchInString(LPTSTR, LPTSTR, size_t, DWORD, PREG_STRING_REPLACE, LPDWORD, BOOL);
  352. BOOL ComputeLocalProfileName(LPCTSTR, LPCTSTR, LPTSTR, size_t, UINT);
  353. void UpdateProgress();
  354. BOOL IsAdmin();
  355. HRESULT ReplaceValueSettings (LPTSTR, LPTSTR, DWORD, LPTSTR, DWORD, PREG_STRING_REPLACE, PVALLIST*, LPTSTR, BOOL);
  356. LPTSTR ReplaceSingleString (LPTSTR, DWORD, PREG_STRING_REPLACE, LPTSTR, LPDWORD, BOOL);
  357. DWORD AddNodeToList (PVALLIST, PVALLIST*);
  358. DWORD RemoveValueList (PVALLIST*);
  359. DWORD GetMaxStrLen (PREG_STRING_REPLACE);
  360. BOOL DoesUserHavePrivilege(PTSTR);
  361. BOOL EnablePrivilege(PTSTR,BOOL);
  362. BOOL UnProtectSFPFiles(LPTSTR,LPDWORD);
  363. HRESULT MyGetShortPathName(LPCTSTR,LPCTSTR,LPCTSTR,LPTSTR,DWORD);
  364. BOOL Str2KeyPath2(LPCTSTR, PHKEY, LPCTSTR*);
  365. DWORD Str2REG(LPCTSTR);
  366. BOOL GetBackupDir(LPCTSTR,LPTSTR, size_t,BOOL);
  367. HRESULT ReplaceCurrentControlSet(LPTSTR);
  368. HRESULT AddRegKeyRename(LPTSTR, LPTSTR, LPTSTR, LPTSTR);
  369. HRESULT AddRegValueRename(LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPTSTR, DWORD, DWORD, LPTSTR);
  370. HRESULT AddFolderRename(LPTSTR, LPTSTR,DWORD, LPTSTR);
  371. DWORD GetMaxMatchNum (LPTSTR,PREG_STRING_REPLACE);
  372. HRESULT InfGenerateStringsSection(LPCTSTR, LPTSTR, SIZE_T);
  373. HRESULT InfCopySectionWithPrefix(LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR);
  374. HRESULT MultiSZ2String(IN LPTSTR, IN TCHAR,OUT LPTSTR *);
  375. DWORD MultiSZNumOfString(IN LPTSTR );
  376. void FreePointer(void *);
  377. HRESULT GetCLMTStatus(PDWORD pdwRunStatus);
  378. HRESULT SetCLMTStatus(DWORD dwRunStatus);
  379. HRESULT GetSavedInstallLocale(LCID *plcid);
  380. HRESULT SaveInstallLocale(void);
  381. HRESULT MultiSZ2String(IN LPTSTR, IN TCHAR,OUT LPTSTR *);
  382. DWORD MultiSZNumOfString(IN LPTSTR );
  383. void BoostMyPriority(void);
  384. HRESULT SetInstallLocale(LCID);
  385. HRESULT MyCreateHardLink(LPCTSTR, LPCTSTR);
  386. BOOL CreateSymbolicLink(LPTSTR,LPTSTR,BOOL);
  387. BOOL GetSymbolicLink(LPTSTR, LPTSTR, DWORD);
  388. HRESULT MergeDirectory(LPCTSTR, LPCTSTR);
  389. BOOL CALLBACK DoCriticalDlgProc(HWND, UINT, WPARAM, LPARAM);
  390. HRESULT RenameRegRoot (LPCTSTR, LPTSTR, DWORD, LPCTSTR, LPCTSTR);
  391. DWORD AdjustRegSecurity (HKEY, LPCTSTR, LPCTSTR, BOOL);
  392. HRESULT GetFirstNTFSDrive(LPTSTR, DWORD);
  393. HRESULT DuplicateString(LPTSTR *, LPDWORD, LPCTSTR);
  394. HRESULT DeleteDirectory(LPCTSTR);
  395. HRESULT MyDeleteFile(LPCTSTR);
  396. HRESULT GetDCInfo(PBOOL, LPTSTR, PDWORD);
  397. VOID RemoveSubString(LPTSTR, LPCTSTR);
  398. //
  399. //utils2.cpp
  400. //
  401. BOOL IsServiceRunning(LPCTSTR);
  402. HRESULT AddNeedUpdateLnkFile(LPTSTR, PREG_STRING_REPLACE);
  403. HRESULT UpdateSecurityTemplates(LPTSTR, PREG_STRING_REPLACE);
  404. HRESULT BatchFixPathInLink(HINF hInf,LPTSTR lpszSection);
  405. HRESULT RenameRDN(LPTSTR, LPTSTR, LPTSTR);
  406. HRESULT PropertyValueHelper(LPTSTR, LPTSTR, LPTSTR*, LPTSTR);
  407. HRESULT BatchINFUpdate(HINF);
  408. //
  409. //From table.c
  410. //
  411. BOOL InitStrRepaceTable(void);
  412. void DeInitStrRepaceTable(void);
  413. //
  414. // From loopuser.c
  415. //
  416. #ifdef STRICT
  417. typedef HRESULT (CALLBACK *USERENUMPROC)(HKEY,LPTSTR,LPTSTR,LPTSTR);
  418. #else // !STRICT
  419. typedef FARPROC USERENUMPROC;
  420. #endif // !STRICT
  421. BOOL LoopUser(USERENUMPROC);
  422. //
  423. // From user.c
  424. //
  425. #ifdef STRICT
  426. typedef HRESULT (CALLBACK *PROFILEENUMPROC)(LPCTSTR, LPCTSTR);
  427. #else // !STRICT
  428. typedef FARPROC PROFILEENUMPROC;
  429. #endif // !STRICT
  430. HRESULT EnumUserProfile(PROFILEENUMPROC);
  431. HRESULT AnalyzeMiscProfilePathPerUser(LPCTSTR, LPCTSTR);
  432. HRESULT ResetMiscProfilePathPerUser(LPCTSTR, LPCTSTR);
  433. LPTSTR ReplaceLocStringInPath(LPCTSTR, BOOL);
  434. HRESULT GetFQDN(LPTSTR, LPTSTR, LPTSTR *);
  435. //
  436. // From inf.c
  437. //
  438. HRESULT UpdateDSObjProp(HINF, LPTSTR);
  439. HRESULT FinalUpdateRegForUser(HKEY, LPTSTR, LPTSTR, LPTSTR);
  440. HRESULT UpdateRegPerUser(HKEY, LPTSTR, LPTSTR,LPTSTR);
  441. BOOL LnkFileUpdate(LPTSTR);
  442. BOOL SecTempUpdate(LPTSTR);
  443. HRESULT StopServices(HINF);
  444. HRESULT RegUpdate(HINF hInf, HKEY hKey , LPTSTR lpszUsersid);
  445. BOOL LookUpStringInTable(PSTRING_TO_DATA, LPCTSTR, PHKEY);
  446. HRESULT UsrGrpAndDoc_and_SettingsRename(HINF,BOOL);
  447. HRESULT EnsureDoItemInfFile(LPTSTR,size_t);
  448. HRESULT INFCreateHardLink(HINF,LPTSTR,BOOL);
  449. HRESULT FolderMove(HINF, LPTSTR,BOOL);
  450. HRESULT ResetServiceStatus(LPCTSTR, DWORD, DWORD);
  451. HRESULT AnalyzeServicesStartUp(HINF, LPCTSTR);
  452. HRESULT AnalyzeServicesStatus(HINF, LPCTSTR);
  453. HRESULT ResetServicesStatus(HINF, LPCTSTR);
  454. HRESULT ResetServicesStartUp(HINF, LPCTSTR);
  455. VOID DoServicesAnalyze();
  456. HRESULT INFVerifyHardLink(HINF,LPTSTR);
  457. //
  458. //From DLL.C
  459. //
  460. BOOL DoMigPerSystem (VOID);
  461. HRESULT MigrateShellPerUser(HKEY, LPCTSTR, LPCTSTR,LPTSTR);
  462. LONG DoMig(DWORD);
  463. BOOL InitGlobals(DWORD);
  464. //
  465. //From Registry.C
  466. //
  467. LONG MyRegSetDWValue(HKEY, LPCTSTR, LPCTSTR, LPCTSTR);
  468. LONG RegResetValue(HKEY, LPCTSTR, LPCTSTR, DWORD, LPCTSTR, LPCTSTR, DWORD, LPCTSTR);
  469. LONG RegResetValueName(HKEY, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR);
  470. LONG RegResetKeyName(HKEY, LPCTSTR, LPCTSTR, LPCTSTR);
  471. LONG RegGetValue(HKEY,LPTSTR,LPTSTR,LPDWORD,LPBYTE,LPDWORD);
  472. LONG RegRenameValueName(HKEY, LPCTSTR, LPCTSTR);
  473. LONG SetRegistryValue(HKEY, LPCTSTR, LPCTSTR, DWORD, LPBYTE, DWORD);
  474. LONG GetRegistryValue(HKEY, LPCTSTR, LPCTSTR, LPBYTE, LPDWORD);
  475. HRESULT MigrateRegSchemesPerSystem(HINF);
  476. HRESULT MigrateRegSchemesPerUser(HKEY, LPCTSTR, LPCTSTR, LPCTSTR);
  477. LONG My_QueryValueEx(HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
  478. HRESULT SetSectionName (LPTSTR, LPTSTR *);
  479. HRESULT ReadFieldFromContext(PINFCONTEXT, LPWSTR[], DWORD, DWORD);
  480. //
  481. //From enumfile.c
  482. //
  483. typedef FARPROC ENUMPROC;
  484. #ifdef STRICT
  485. typedef BOOL (CALLBACK *FILEENUMPROC)(LPTSTR);
  486. #else // !STRICT
  487. typedef FARPROC FILEENUMPROC;
  488. #endif // !STRICT
  489. BOOL MyEnumFiles(LPTSTR, LPTSTR, FILEENUMPROC);
  490. //
  491. //for log.c
  492. //
  493. typedef enum
  494. {
  495. dlNone = 0,
  496. dlPrint,
  497. dlFail,
  498. dlError,
  499. dlWarning,
  500. dlInfo
  501. } DEBUGLEVEL;
  502. typedef struct _LOG_REPORT
  503. {
  504. DWORD dwMsgNum;
  505. DWORD dwFailNum;
  506. DWORD dwErrNum;
  507. DWORD dwWarNum;
  508. DWORD dwInfNum;
  509. } LOG_REPORT;
  510. #define DEBUG_SPEW
  511. extern FILE *pLogFile;
  512. extern LOG_REPORT g_LogReport;
  513. //define debug area
  514. #define DEBUG_ALL 0x0
  515. #define DEBUG_APPLICATION 0x10
  516. #define DEBUG_REGISTRY 0x20
  517. #define DEBUG_SHELL 0x30
  518. #define DEBUG_PROFILE 0x40
  519. #define DEBUG_INF_FILE 0x80
  520. #define APPmsg (DEBUG_APPLICATION | dlPrint)
  521. #define APPfail (DEBUG_APPLICATION | dlFail)
  522. #define APPerr (DEBUG_APPLICATION | dlError)
  523. #define APPwar (DEBUG_APPLICATION | dlWarning)
  524. #define APPinf (DEBUG_APPLICATION | dlInfo)
  525. #define REGmsg (DEBUG_REGISTRY | dlPrint)
  526. #define REGfail (DEBUG_REGISTRY | dlFail)
  527. #define REGerr (DEBUG_REGISTRY | dlError)
  528. #define REGwar (DEBUG_REGISTRY | dlWarning)
  529. #define REGinf (DEBUG_REGISTRY | dlInfo)
  530. #define SHLmsg (DEBUG_SHELL | dlPrint)
  531. #define SHLfail (DEBUG_SHELL | dlFail)
  532. #define SHLerr (DEBUG_SHELL | dlError)
  533. #define SHLwar (DEBUG_SHELL | dlWarning)
  534. #define SHLinf (DEBUG_SHELL | dlInfo)
  535. #define PROmsg (DEBUG_PROFILE | dlPrint)
  536. #define PROfail (DEBUG_PROFILE | dlFail)
  537. #define PROerr (DEBUG_PROFILE | dlError)
  538. #define PROwar (DEBUG_PROFILE | dlWarning)
  539. #define PROinf (DEBUG_PROFILE | dlInfo)
  540. #define INFmsg (DEBUG_INF_FILE | dlPrint)
  541. #define INFfail (DEBUG_INF_FILE | dlFail)
  542. #define INFerr (DEBUG_INF_FILE | dlError)
  543. #define INFwar (DEBUG_INF_FILE | dlWarning)
  544. #define INFinf (DEBUG_INF_FILE | dlInfo)
  545. #define DPF DebugPrintfEx
  546. #define LOG_FILE_NAME TEXT("\\debug\\clmt.log")
  547. void DebugPrintfEx(DWORD dwDetail, LPWSTR pszFmt, ...);
  548. HRESULT InitDebugSupport(DWORD);
  549. void CloseDebug(void);
  550. HRESULT InitChangeLog(VOID);
  551. HRESULT AddFileChangeLog(DWORD, LPCTSTR, LPCTSTR);
  552. HRESULT AddServiceChangeLog(LPCTSTR, DWORD, DWORD);
  553. HRESULT AddUserNameChangeLog(LPCTSTR, LPCTSTR);
  554. BOOL GetUserNameChangeLog(LPCTSTR, LPTSTR, DWORD);
  555. //
  556. // From shell.c
  557. //
  558. HRESULT DoShellFolderRename(HINF, HKEY, LPTSTR);
  559. HRESULT FixFolderPath(INT, HKEY ,HINF, LPTSTR, BOOL );
  560. //
  561. // From criteria.c
  562. //
  563. BOOL CheckSystemCriteria(VOID);
  564. HRESULT CheckCLMTStatus(LPDWORD, LPDWORD, PUINT);
  565. HRESULT CLMTGetMachineState(LPDWORD);
  566. HRESULT CLMTSetMachineState(DWORD);
  567. BOOL IsNT5(VOID);
  568. BOOL IsDotNet(VOID);
  569. BOOL IsNEC98(VOID);
  570. BOOL IsIA64(VOID);
  571. BOOL IsDomainController(VOID);
  572. BOOL IsOnTSClient(VOID);
  573. BOOL IsTSInstalled(VOID);
  574. BOOL IsTSConnectionEnabled(VOID);
  575. BOOL IsTSServiceRunning(VOID);
  576. BOOL IsOtherSessionOnTS(VOID);
  577. BOOL IsUserOKWithCheckUpgrade(VOID);
  578. HRESULT DisableWinstations(DWORD, LPDWORD);
  579. BOOL DisplayTaskList();
  580. INT ShowStartUpDialog();
  581. BOOL IsOneInstance(VOID);
  582. BOOL CheckAdminPrivilege(VOID);
  583. VOID ShowReadMe();
  584. //
  585. // From aclmgmt.cpp
  586. //
  587. DWORD AdjustObjectSecurity (LPTSTR, SE_OBJECT_TYPE, BOOL);
  588. HRESULT IsObjectAccessiablebyLocalSys(
  589. LPTSTR lpObjectName,
  590. SE_OBJECT_TYPE ObjectType,
  591. PBOOL pbCanAccess);
  592. //
  593. // From outlook.cpp
  594. //
  595. HRESULT UpdatePSTpath(HKEY, LPTSTR, LPTSTR, LPTSTR, PREG_STRING_REPLACE);
  596. //
  597. // From config16.c
  598. //
  599. BOOL Remove16bitFEDrivers(void);
  600. #ifdef __cplusplus
  601. } // extern "C"
  602. #endif
  603. #endif