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.

203 lines
8.1 KiB

  1. //+------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1993.
  5. //
  6. // File: regmain.cxx
  7. //
  8. // Contents: registration of developer regression tests and benchmrk
  9. // tests.
  10. //
  11. // Functions: RegistrySetup
  12. //
  13. // History: 23-May-96 Rickhi Created
  14. //
  15. //--------------------------------------------------------------------------
  16. #include <pch.cxx>
  17. #include <regmain.hxx>
  18. #define REGISTRY_ENTRY_LEN 256
  19. typedef struct
  20. {
  21. const char *key;
  22. const char *value;
  23. } RegistryKeyValue;
  24. const RegistryKeyValue REG_CONST_KEY[] =
  25. {
  26. ".bm1", "CLSID\\{99999999-0000-0008-C000-000000000052}",
  27. ".bm2", "CLSID\\{99999999-0000-0008-C000-000000000051}",
  28. "CLSID\\{20730701-0001-0008-C000-000000000046}", "OleTestClass",
  29. "CLSID\\{20730711-0001-0008-C000-000000000046}", "OleTestClass1",
  30. "CLSID\\{20730712-0001-0008-C000-000000000046}", "OleTestClass2",
  31. "CLSID\\{20730713-0001-0008-C000-000000000046}", "OleTestClass3",
  32. "CLSID\\{20730714-0001-0008-C000-000000000046}", "OleTestClass4",
  33. "CLSID\\{20730715-0001-0008-C000-000000000046}", "OleTestClass5",
  34. "CLSID\\{20730716-0001-0008-C000-000000000046}", "OleTestClass6",
  35. "CLSID\\{20730717-0001-0008-C000-000000000046}", "OleTestClass7",
  36. "CLSID\\{20730718-0001-0008-C000-000000000046}", "OleTestClass8",
  37. "CLSID\\{00000138-0001-0008-C000-000000000046}", "CPrxyBalls",
  38. "Interface\\{00000138-0001-0008-C000-000000000046}", "IBalls",
  39. "Interface\\{00000139-0001-0008-C000-000000000046}", "ICube",
  40. "Interface\\{00000136-0001-0008-C000-000000000046}", "ILoops",
  41. "Interface\\{00000137-0001-0008-C000-000000000046}", "IRpcTest",
  42. "Interface\\{00000138-0001-0008-C000-000000000046}\\ProxyStubClsid32", "{00000138-0001-0008-C000-000000000046}",
  43. "Interface\\{00000139-0001-0008-C000-000000000046}\\ProxyStubClsid32", "{00000138-0001-0008-C000-000000000046}",
  44. "Interface\\{00000136-0001-0008-C000-000000000046}\\ProxyStubClsid32", "{00000138-0001-0008-C000-000000000046}",
  45. "Interface\\{00000137-0001-0008-C000-000000000046}\\ProxyStubClsid32", "{00000138-0001-0008-C000-000000000046}",
  46. "CLSID\\{0000013a-0001-0008-C000-000000000046}\\ProgID", "ProgID60",
  47. "CLSID\\{0000013a-0001-0008-C000-000000000046}", "CBallsClassFactory",
  48. "CLSID\\{0000013b-0001-0008-C000-000000000046}", "CCubesClassFactory",
  49. "CLSID\\{0000013c-0001-0008-C000-000000000046}", "CLoopClassFactory",
  50. "CLSID\\{0000013d-0001-0008-C000-000000000046}", "CRpcTestClassFactory",
  51. "CLSID\\{0000013e-0001-0008-C000-000000000046}", "CHandCraftedProxy",
  52. "CLSID\\{00000140-0000-0008-C000-000000000046}", "CQueryInterface",
  53. "CLSID\\{00000141-0000-0008-C000-000000000046}", "CQueryInterfaceHandler",
  54. ".ut4", "ProgID50",
  55. ".ut5", "ProgID51",
  56. ".ut6", "ProgID52",
  57. ".ut7", "ProgID53",
  58. ".ut8", "ProgID54",
  59. ".ut9", "ProgID55",
  60. ".bls", "ProgID60",
  61. "CLSID\\{99999999-0000-0008-C000-000000000050}", "SDI",
  62. "CLSID\\{99999999-0000-0008-C000-000000000051}", "MDI",
  63. "CLSID\\{99999999-0000-0008-C000-000000000052}", "InprocNoRegister",
  64. "CLSID\\{99999999-0000-0008-C000-000000000053}", "InprocRegister",
  65. "CLSID\\{99999999-0000-0008-C000-000000000054}", "InprocRegister",
  66. "CLSID\\{99999999-0000-0008-C000-000000000054}\\TreatAs", "{99999999-0000-0008-C000-000000000050}",
  67. "CLSID\\{99999999-0000-0008-C000-000000000055}", "MDI",
  68. "CLSID\\{99999999-0000-0008-C000-000000000055}\\ActivateAtBits", "Y",
  69. "ProgID50", "objact sdi",
  70. "ProgID50\\CLSID", "{99999999-0000-0008-C000-000000000050}",
  71. "ProgID51", "objact mdi",
  72. "ProgID51\\CLSID", "{99999999-0000-0008-C000-000000000051}",
  73. "ProgID52", "objact dll",
  74. "ProgID52\\CLSID", "{99999999-0000-0008-C000-000000000052}",
  75. "ProgID53", "objact dll reg",
  76. "ProgID53\\CLSID", "{99999999-0000-0008-C000-000000000053}",
  77. "ProgID54", "objact dll reg",
  78. "ProgID54\\CLSID", "{99999999-0000-0008-C000-000000000054}",
  79. "ProgID55", "remote activation",
  80. "ProgID55\\CLSID", "{99999999-0000-0008-C000-000000000055}",
  81. "ProgID60", "CLSIDFromProgID test",
  82. "ProgID60\\CLSID", "{0000013a-0001-0008-C000-000000000046}",
  83. // Indicates end of list.
  84. "", ""
  85. };
  86. const RegistryKeyValue REG_EXE_KEY[] =
  87. {
  88. "CLSID\\{20730701-0001-0008-C000-000000000046}\\InprocServer32", "oletest.dll",
  89. "CLSID\\{20730711-0001-0008-C000-000000000046}\\InprocServer32", "oletest.dll",
  90. "CLSID\\{20730712-0001-0008-C000-000000000046}\\InprocServer32", "oletest.dll",
  91. "CLSID\\{20730713-0001-0008-C000-000000000046}\\InprocServer32", "oletest.dll",
  92. "CLSID\\{20730714-0001-0008-C000-000000000046}\\InprocServer32", "oletest.dll",
  93. "CLSID\\{20730715-0001-0008-C000-000000000046}\\InprocServer32", "oletest.dll",
  94. "CLSID\\{20730716-0001-0008-C000-000000000046}\\InprocServer32", "oletest.dll",
  95. "CLSID\\{20730717-0001-0008-C000-000000000046}\\InprocServer32", "oletest.dll",
  96. "CLSID\\{20730718-0001-0008-C000-000000000046}\\InprocServer32", "oletest.dll",
  97. "CLSID\\{20730712-0001-0008-C000-000000000046}\\LocalServer32", "bmtstsvr.exe",
  98. "CLSID\\{20730701-0001-0008-C000-000000000046}\\LocalServer32", "bmtstsvr.exe",
  99. "CLSID\\{0000013a-0001-0008-C000-000000000046}\\LocalServer32", "ballsrv.exe",
  100. "CLSID\\{00000138-0001-0008-C000-000000000046}\\InprocServer32", "iballs.dll",
  101. "CLSID\\{0000013b-0001-0008-C000-000000000046}\\LocalServer32", "cubesrv.exe",
  102. "CLSID\\{0000013c-0001-0008-C000-000000000046}\\LocalServer32", "loopsrv.exe",
  103. "CLSID\\{0000013d-0001-0008-C000-000000000046}\\LocalServer32", "rpctst.exe",
  104. "CLSID\\{0000013e-0001-0008-C000-000000000046}\\InprocServer32", "myproxy.dll",
  105. "CLSID\\{00000140-0000-0008-C000-000000000046}\\LocalServer32", "qisrv.exe",
  106. "CLSID\\{00000140-0000-0008-C000-000000000046}\\InprocServer32", "qisrv.dll",
  107. "CLSID\\{00000141-0000-0008-C000-000000000046}\\LocalServer32", "qisrv.exe",
  108. "CLSID\\{00000141-0000-0008-C000-000000000046}\\InprocHandler32", "ole32.dll",
  109. "CLSID\\{99999999-0000-0008-C000-000000000050}\\LocalServer32", "sdi.exe",
  110. "CLSID\\{99999999-0000-0008-C000-000000000051}\\LocalServer32", "mdi.exe",
  111. "CLSID\\{99999999-0000-0008-C000-000000000052}\\InprocServer32", "dlltest.dll",
  112. "CLSID\\{99999999-0000-0008-C000-000000000053}\\InprocServer32", "dlltest.dll",
  113. "CLSID\\{99999999-0000-0008-C000-000000000055}\\LocalServer32", "db.exe",
  114. // Indicates end of list.
  115. "", ""
  116. };
  117. //+-------------------------------------------------------------------
  118. //
  119. // Function: RegistrySetup
  120. //
  121. // Synopsis: write the registry entries for this program
  122. //
  123. // Note: This function uses all Ascii characters and character
  124. // arithmatic because it has to run on NT and Chicago.
  125. //
  126. // History: 16 Dec 94 AlexMit Created
  127. //
  128. //--------------------------------------------------------------------
  129. BOOL RegistrySetup(char *pszAppName)
  130. {
  131. char value[REGISTRY_ENTRY_LEN];
  132. LONG value_size;
  133. LONG result;
  134. char directory[MAX_PATH];
  135. char *appname;
  136. BOOL success = FALSE;
  137. // Write constant entries.
  138. for (int i = 0; REG_CONST_KEY[i].key[0] != '\0'; i++)
  139. {
  140. result = RegSetValueA(
  141. HKEY_CLASSES_ROOT,
  142. REG_CONST_KEY[i].key,
  143. REG_SZ,
  144. REG_CONST_KEY[i].value,
  145. strlen(REG_CONST_KEY[i].value) );
  146. if (result != ERROR_SUCCESS)
  147. goto cleanup;
  148. }
  149. // Compute the path to the application.
  150. result = GetFullPathNameA(pszAppName, sizeof(directory), directory, &appname);
  151. if (result == 0)
  152. goto cleanup;
  153. // Add the path to all the dll and exe entries.
  154. for (i = 0; REG_EXE_KEY[i].key[0] != '\0'; i++)
  155. {
  156. // Verify that the path will fit in the buffer and compute the path
  157. // to the next executable.
  158. if (strlen(REG_EXE_KEY[i].value) >=
  159. (ULONG)(MAX_PATH - (appname - directory)))
  160. goto cleanup;
  161. strcpy(appname, REG_EXE_KEY[i].value);
  162. // Write the next entry.
  163. result = RegSetValueA(
  164. HKEY_CLASSES_ROOT,
  165. REG_EXE_KEY[i].key,
  166. REG_SZ,
  167. directory,
  168. strlen(directory));
  169. if (result != ERROR_SUCCESS)
  170. goto cleanup;
  171. }
  172. success = TRUE;
  173. cleanup:
  174. return success;
  175. }
  176.