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.

196 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. hkcrtool.c
  5. Abstract:
  6. Implements a stub tool that is designed to run with NT-side
  7. upgrade code.
  8. Author:
  9. <full name> (<alias>) <date>
  10. Revision History:
  11. <alias> <date> <comments>
  12. --*/
  13. #include "pch.h"
  14. BOOL
  15. Init (
  16. VOID
  17. )
  18. {
  19. HINSTANCE hInstance;
  20. DWORD dwReason;
  21. PVOID lpReserved;
  22. //
  23. // Simulate DllMain
  24. //
  25. hInstance = GetModuleHandle (NULL);
  26. dwReason = DLL_PROCESS_ATTACH;
  27. lpReserved = NULL;
  28. //
  29. // Initialize DLL globals
  30. //
  31. if (!FirstInitRoutine (hInstance)) {
  32. return FALSE;
  33. }
  34. //
  35. // Initialize all libraries
  36. //
  37. if (!InitLibs (hInstance, dwReason, lpReserved)) {
  38. return FALSE;
  39. }
  40. //
  41. // Final initialization
  42. //
  43. if (!FinalInitRoutine ()) {
  44. return FALSE;
  45. }
  46. return TRUE;
  47. }
  48. VOID
  49. Terminate (
  50. VOID
  51. )
  52. {
  53. HINSTANCE hInstance;
  54. DWORD dwReason;
  55. PVOID lpReserved;
  56. //
  57. // Simulate DllMain
  58. //
  59. hInstance = GetModuleHandle (NULL);
  60. dwReason = DLL_PROCESS_DETACH;
  61. lpReserved = NULL;
  62. //
  63. // Call the cleanup routine that requires library APIs
  64. //
  65. FirstCleanupRoutine();
  66. //
  67. // Clean up all libraries
  68. //
  69. TerminateLibs (hInstance, dwReason, lpReserved);
  70. //
  71. // Do any remaining clean up
  72. //
  73. FinalCleanupRoutine();
  74. }
  75. INT
  76. __cdecl
  77. wmain (
  78. INT argc,
  79. WCHAR *argv[]
  80. )
  81. {
  82. REGKEY_ENUM e1, e;
  83. HKEY Key;
  84. BOOL b;
  85. PCTSTR Data;
  86. TCHAR KeyName[MAX_REGISTRY_KEY];
  87. if (!Init()) {
  88. wprintf (L"Unable to initialize!\n");
  89. return 255;
  90. }
  91. if (1) {
  92. _tprintf (TEXT("Keys in CLSID that are in TypeLib too:\n\n"));
  93. if (EnumFirstRegKeyStr (&e1, TEXT("HKLM\\Software\\Classes\\CLSID"))) {
  94. do {
  95. wsprintf (KeyName, TEXT("HKLM\\Software\\Classes\\TypeLib\\%s"), e1.SubKeyName);
  96. Key = OpenRegKeyStr (KeyName);
  97. if (Key) {
  98. _tprintf (TEXT("%s\n"), e1.SubKeyName);
  99. CloseRegKey (Key);
  100. }
  101. } while (EnumNextRegKey (&e1));
  102. }
  103. }
  104. else if (0) {
  105. _tprintf (TEXT("Overwritable GUIDs:\n\n"));
  106. if (EnumFirstRegKeyStr (&e1, TEXT("HKLM\\Software\\Classes\\CLSID"))) {
  107. do {
  108. Key = OpenRegKey (e1.KeyHandle, e1.SubKeyName);
  109. b = TRUE;
  110. if (EnumFirstRegKey (&e, Key)) {
  111. do {
  112. if (StringIMatchCharCount (e.SubKeyName, TEXT("Inproc"), 6) ||
  113. StringIMatch (e.SubKeyName, TEXT("LocalServer")) ||
  114. StringIMatch (e.SubKeyName, TEXT("LocalServer32")) ||
  115. StringIMatch (e.SubKeyName, TEXT("ProxyStubClsid32"))
  116. ) {
  117. b = FALSE;
  118. break;
  119. }
  120. } while (EnumNextRegKey (&e));
  121. }
  122. if (b) {
  123. Data = (PCTSTR) GetRegKeyData (e1.KeyHandle, e1.SubKeyName);
  124. if (Data && *Data) {
  125. _tprintf (TEXT(" %s\n"), Data);
  126. MemFree (g_hHeap, 0, Data);
  127. } else {
  128. _tprintf (TEXT(" GUID: %s\n"), e1.SubKeyName);
  129. }
  130. if (EnumFirstRegKey (&e, Key)) {
  131. do {
  132. _tprintf (TEXT(" %s\n"), e.SubKeyName);
  133. } while (EnumNextRegKey (&e));
  134. }
  135. }
  136. CloseRegKey (Key);
  137. } while (EnumNextRegKey (&e1));
  138. }
  139. }
  140. Terminate();
  141. return 0;
  142. }