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.

234 lines
5.6 KiB

  1. //-------------------------------------------------------------------
  2. //
  3. // FILE: LicBvtRm.Cpp
  4. //
  5. // Summary;
  6. // The License Setup Remote Routines BVT
  7. //
  8. // Notes;
  9. //
  10. // History
  11. // 4/25/95 MikeMi Created
  12. //
  13. //-------------------------------------------------------------------
  14. #include <windows.h>
  15. #include <stdio.h>
  16. typedef BOOL (CALLBACK* CPLSETUPPROC)(INT, LPSTR[], LPSTR* );
  17. //BOOL APIENTRY CPlSetup( DWORD nArgs, LPSTR apszArgs[], LPSTR *ppszResult )
  18. #define szBOOL( ftf ) ftf?"TRUE":"FALSE"
  19. //-------------------------------------------------------------------
  20. void PressNGo()
  21. {
  22. printf( "press enter to continue..." );
  23. getchar();
  24. printf( "\n" );
  25. }
  26. //-------------------------------------------------------------------
  27. void RemoteUnattedned( CPLSETUPPROC prf, LPSTR pszComputer )
  28. {
  29. BOOL frt;
  30. LPSTR apszArgs[7];
  31. LPSTR pszReturn;
  32. printf( "RemoteUnattened " );
  33. // your cool code here
  34. apszArgs[0] = "RemoteUnattended" ;
  35. apszArgs[1] = pszComputer;
  36. apszArgs[2] = "CoolService";
  37. apszArgs[3] = "Microsoft's CoolService";
  38. apszArgs[4] = "Microsoft's CoolService for the hip 2.51";
  39. apszArgs[5] = "PerSeat";
  40. apszArgs[6] = "0";
  41. frt = prf( 7, apszArgs, &pszReturn );
  42. if ( (frt) && (0 == lstrcmpiA( pszReturn, "OK")) )
  43. {
  44. // no problems
  45. printf( "Passed.\n");
  46. }
  47. else
  48. {
  49. printf( "Failed: returned %s with a status of %s.\n",
  50. szBOOL( frt ), pszReturn );
  51. }
  52. }
  53. //-------------------------------------------------------------------
  54. void RemoteSetup( CPLSETUPPROC prf, LPSTR pszComputer, LPSTR szRoutine )
  55. {
  56. BOOL frt;
  57. LPSTR apszArgs[10];
  58. LPSTR pszReturn;
  59. printf( "%s ", szRoutine );
  60. apszArgs[0] = szRoutine;
  61. apszArgs[1] = pszComputer;
  62. apszArgs[2] = "0";
  63. apszArgs[3] = "CoolService";
  64. apszArgs[4] = "Microsoft's CoolService";
  65. apszArgs[5] = "Microsoft's CoolService for the hip 2.51";
  66. frt = prf( 6, apszArgs, &pszReturn );
  67. if ( (frt) && (0 == lstrcmpiA( pszReturn, "OK")) )
  68. {
  69. // no problems
  70. printf( "Passed.\n\n" );
  71. }
  72. else
  73. {
  74. printf( "Failed: returned %s with a status of %s.\n\n",
  75. szBOOL( frt ), pszReturn );
  76. }
  77. }
  78. //-------------------------------------------------------------------
  79. void LocalSetup( CPLSETUPPROC prf, LPSTR szRoutine )
  80. {
  81. BOOL frt;
  82. LPSTR apszArgs[10];
  83. LPSTR pszReturn;
  84. printf( "%s ", szRoutine );
  85. apszArgs[0] = szRoutine;
  86. apszArgs[1] = "0";
  87. apszArgs[2] = "CoolService";
  88. apszArgs[3] = "Microsoft's CoolService";
  89. apszArgs[4] = "Microsoft's CoolService for the hip 2.51";
  90. frt = prf( 5, apszArgs, &pszReturn );
  91. if ( (frt) && (0 == lstrcmpiA( pszReturn, "OK")) )
  92. {
  93. // no problems
  94. printf( "Passed.\n\n" );
  95. }
  96. else
  97. {
  98. printf( "Failed: returned %s with a status of %s.\n\n",
  99. szBOOL( frt ), pszReturn );
  100. }
  101. }
  102. //-------------------------------------------------------------------
  103. void LocalUnattedned( CPLSETUPPROC prf, LPSTR pszComputer )
  104. {
  105. BOOL frt;
  106. LPSTR apszArgs[7];
  107. LPSTR pszReturn;
  108. printf( "Unattened " );
  109. // your cool code here
  110. apszArgs[0] = "Unattended" ;
  111. apszArgs[1] = "CoolService";
  112. apszArgs[2] = "Microsoft's CoolService";
  113. apszArgs[3] = "Microsoft's CoolService for the hip 2.51";
  114. apszArgs[4] = "PerSeat";
  115. apszArgs[5] = "0";
  116. frt = prf( 6, apszArgs, &pszReturn );
  117. if ( (frt) && (0 == lstrcmpiA( pszReturn, "OK")) )
  118. {
  119. // no problems
  120. printf( "Passed.\n");
  121. }
  122. else
  123. {
  124. printf( "Failed: returned %s with a status of %s.\n",
  125. szBOOL( frt ), pszReturn );
  126. }
  127. }
  128. //-------------------------------------------------------------------
  129. void RunTests( CPLSETUPPROC pfn, LPSTR pszComputer )
  130. {
  131. /*
  132. RemoteUnattedned( pfn, pszComputer );
  133. PressNGo();
  134. RemoteSetup( pfn, pszComputer, "RemotePerSeat" );
  135. PressNGo();
  136. RemoteSetup( pfn, pszComputer, "RemoteFullSetup" );
  137. PressNGo();
  138. RemoteSetup( pfn, pszComputer, "RemoteFullSetupNoExit" );
  139. */
  140. LocalUnattedned( pfn, pszComputer );
  141. PressNGo();
  142. LocalSetup( pfn, "PerSeat" );
  143. PressNGo();
  144. LocalSetup( pfn, "FullSetup" );
  145. PressNGo();
  146. LocalSetup( pfn, "FullSetupNoExit" );
  147. }
  148. //-------------------------------------------------------------------
  149. void _cdecl main( int argc, char *argv[ ], char *envp[ ] )
  150. {
  151. HINSTANCE hinstLicCpa;
  152. CPLSETUPPROC pfn;
  153. LPSTR pszComputer;
  154. printf( "LicBvtRm.Exe - The License Setup (Remote) Build Verification Test\n" );
  155. if (argc <= 2)
  156. {
  157. if (argc == 1)
  158. {
  159. pszComputer = NULL;
  160. }
  161. else
  162. {
  163. pszComputer = argv[1];
  164. }
  165. hinstLicCpa = LoadLibrary( L"LicCpa.Cpl" );
  166. if (NULL != hinstLicCpa)
  167. {
  168. pfn = (CPLSETUPPROC)GetProcAddress( hinstLicCpa, "CPlSetup" );
  169. if (NULL != pfn)
  170. {
  171. RunTests( pfn, pszComputer );
  172. }
  173. else
  174. {
  175. printf( "GetProcAddress Failed\n" );
  176. }
  177. FreeLibrary( hinstLicCpa );
  178. PressNGo();
  179. }
  180. else
  181. {
  182. printf( "LoadLibary Failed\n" );
  183. }
  184. }
  185. else
  186. {
  187. printf( "This test requires a computername (ie: \\\\Wombat),\n" );
  188. printf( " or nothing, meaning local.\n\n" );
  189. }
  190. }