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.

262 lines
5.7 KiB

  1. #include "precomp.hxx"
  2. #pragma hdrstop
  3. HRESULT RegisterDll(char * pszDll);
  4. extern "C"
  5. {
  6. WINADVAPI LONG APIENTRY RegOverridePredefKey( HKEY, HKEY );
  7. }
  8. void DumpOnePackage(
  9. MESSAGE * pMessage,
  10. PACKAGEDETAIL * p );
  11. void DumpOneAppDetail(
  12. MESSAGE * pMessage,
  13. APPDETAIL * pA );
  14. void DumpOneClass(
  15. MESSAGE * pMessage,
  16. CLASSDETAIL * pClassDetail );
  17. void DumpIIDEntries(
  18. IIDICT * pIIDict );
  19. void DumpOneIIDEntry(
  20. ITF_ENTRY * pITFEntry );
  21. HRESULT VerifyArguments(
  22. MESSAGE * pMessage );
  23. void
  24. DumpOneTypelib(
  25. MESSAGE * pMessage,
  26. CLSID * pClsid );
  27. char *
  28. ClassPathTypeToString(
  29. CLASSPATHTYPE i );
  30. char *
  31. ProcessorArchitectureToString(
  32. int i );
  33. char *
  34. PlatformIdToString(
  35. int i );
  36. int
  37. __cdecl main( int argc, char * argv[] )
  38. {
  39. MESSAGE Message;
  40. BOOL flag = FALSE;
  41. if( argc < 4 )
  42. {
  43. printf( "Usage: detest <package file name > <darwin script file path> <publish (1) or Assign (0)" );
  44. exit(1);
  45. }
  46. Message.fDumpOnly = 1;
  47. Message.pDumpOnePackage = DumpOnePackage;
  48. Message.pPackagePath = argv[1];
  49. Message.pAuxPath = argv[2];
  50. if( toupper(*(argv[3])) == 'P')
  51. flag = TRUE;
  52. DetectPackageAndRegisterIntoClassStore(&Message, Message.pPackagePath, flag, 0);
  53. return 0;
  54. }
  55. void
  56. DumpOnePackage(
  57. MESSAGE * pMessage,
  58. PACKAGEDETAIL * p )
  59. {
  60. DWORD count;
  61. printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++");
  62. printf( "\nClassPathType = %s", ClassPathTypeToString(p->PathType) );
  63. wprintf(L"\nPackagePath = %s", p->pszPath );
  64. wprintf(L"\nIconPath = %s", p->pszIconPath );
  65. wprintf(L"\nSetup Command = %s", p->pszSetupCommand );
  66. printf("\nActFlags = %d", p->dwActFlags );
  67. wprintf(L"\nVendor = %s", p->pszVendor );
  68. wprintf(L"\nPackageName = %s", p->pszPackageName );
  69. wprintf(L"\nProductName = %s", p->pszProductName );
  70. wprintf(L"\ndwContext = %d", p->dwContext );
  71. printf("\nCsPlatform = (PlatformID= %s, VersionHi = 0x%x, VersionLo = 0x%x, ProcessorArchitecture = %s",
  72. PlatformIdToString( p->Platform.dwPlatformId ),
  73. p->Platform.dwVersionHi,
  74. p->Platform.dwVersionLo,
  75. ProcessorArchitectureToString( p->Platform.dwProcessorArch ) );
  76. wprintf(L"\ndwLocale = 0x%x", p->Locale );
  77. wprintf(L"\ndwVersionHi = %d", p->dwVersionHi );
  78. wprintf(L"\ndwVersionLo = %d", p->dwVersionLo );
  79. wprintf(L"\nCountOfApps = %d", p->cApps );
  80. for( count = 0;
  81. count < p->cApps;
  82. ++count )
  83. {
  84. DumpOneAppDetail( pMessage, &p->pAppDetail[count] );
  85. }
  86. printf("\n--------------------------------------------------");
  87. }
  88. void
  89. DumpOneAppDetail(
  90. MESSAGE * pMessage,
  91. APPDETAIL * pA )
  92. {
  93. char Buffer[ 100 ];
  94. DWORD count;
  95. CLASS_ENTRY * pC;
  96. CLSIDToString( &pA->AppID, &Buffer[0] );
  97. printf( "\n\t\tAPPID = %s", &Buffer[0] );
  98. if( pA->cClasses )
  99. {
  100. for( count = 0;
  101. count < pA->cClasses;
  102. ++count )
  103. {
  104. char Buffer[50];
  105. CLSIDToString( &pA->prgClsIdList[count],&Buffer[0] );
  106. pC = pMessage->pClsDict->Search( &Buffer[0] );
  107. if( pC )
  108. DumpOneClass( pMessage, &pC->ClassAssociation );
  109. }
  110. }
  111. if( pA->cTypeLibIds )
  112. {
  113. for( count = 0;
  114. count < pA->cTypeLibIds;
  115. ++count )
  116. {
  117. DumpOneTypelib( pMessage, pA->prgTypeLibIdList );
  118. }
  119. }
  120. else
  121. printf( "\n\t\t No Typelibs present" );
  122. }
  123. void
  124. DumpOneClass( MESSAGE * pMessage, CLASSDETAIL * pClassDetail )
  125. {
  126. char Buffer[ _MAX_PATH ];
  127. DWORD count;
  128. CLSIDToString( &pClassDetail->Clsid, &Buffer[0] );
  129. printf( "\n\t\t\tCLSID = %s", &Buffer[0] );
  130. wprintf( L"\n\t\t\tDescription = %s", pClassDetail->pszDesc );
  131. wprintf( L"\n\t\t\tIconPath = %s", pClassDetail->pszIconPath );
  132. CLSIDToString( &pClassDetail->TreatAsClsid, &Buffer[0] );
  133. printf( "\n\t\t\tTreatAsClsid = %s", &Buffer[0] );
  134. CLSIDToString( &pClassDetail->AutoConvertClsid, &Buffer[0] );
  135. printf( "\n\t\t\tAutoConvertClsid = %s", &Buffer[0] );
  136. printf("\n\t\t\tCountOfFileExtensions = %d", pClassDetail->cFileExt );
  137. if( pClassDetail->cFileExt )
  138. {
  139. for(count = 0;
  140. count < pClassDetail->cFileExt;
  141. count++
  142. )
  143. {
  144. wprintf( L"\n\t\t\tFileExt = %s", pClassDetail->prgFileExt[ count ] );
  145. }
  146. }
  147. else
  148. {
  149. printf("\n\t\t\tOtherFileExt = None" );
  150. }
  151. wprintf(L"\n\t\t\tMimeType = %s", pClassDetail->pMimeType );
  152. wprintf(L"\n\t\t\tDefaultProgid = %s", pClassDetail->pDefaultProgId );
  153. printf("\n\t\t\tCountOfOtherProgIds = %d", pClassDetail->cOtherProgId );
  154. if( pClassDetail->cOtherProgId )
  155. {
  156. for(count = 0;
  157. count < pClassDetail->cOtherProgId;
  158. count++
  159. )
  160. {
  161. wprintf( L"\n\t\t\tOtherProgId = %s", pClassDetail->prgOtherProgId[ count ] );
  162. }
  163. }
  164. else
  165. {
  166. printf("\n\t\t\tOtherProgId = None" );
  167. }
  168. printf("\n");
  169. }
  170. void
  171. DumpOneTypelib(
  172. MESSAGE * pMessage,
  173. CLSID * pClsid )
  174. {
  175. char Buffer[ _MAX_PATH ];
  176. CLSIDToString( pClsid, &Buffer[0] );
  177. printf( "\n\t\t\tTypelibID = %s", &Buffer[0] );
  178. printf("\n");
  179. }
  180. char *
  181. ClassPathTypeToString(
  182. CLASSPATHTYPE i )
  183. {
  184. static char * Map[] = { "Exe", "Dll", "Tlb", "Cab", "Inf", "Darwin" };
  185. if( i > sizeof( Map ) / sizeof(char *) )
  186. return "Exe";
  187. return Map[ i ];
  188. }
  189. char *
  190. ProcessorArchitectureToString(
  191. int i )
  192. {
  193. static char * Map[] = {
  194. "PROCESSOR_ARCHITECTURE_INTEL",
  195. "PROCESSOR_ARCHITECTURE_MIPS",
  196. "PROCESSOR_ARCHITECTURE_ALPHA",
  197. "PROCESSOR_ARCHITECTURE_PPC",
  198. "PROCESSOR_ARCHITECTURE_SH",
  199. "PROCESSOR_ARCHITECTURE_ARM"
  200. };
  201. if( i > sizeof( Map ) / sizeof( char * ) )
  202. return "PROCESSOR_ARCHITECTURE_UNKNOWN";
  203. return Map[ i ];
  204. }
  205. char *
  206. PlatformIdToString(
  207. int i )
  208. {
  209. static char * Map[] = {
  210. "VER_PLATFORM_WIN32s",
  211. "VER_PLATFORM_WIN32_WINDOWS",
  212. "VER_PLATFORM_WIN32_NT"
  213. };
  214. if( i > sizeof( Map ) / sizeof( char * ) )
  215. return "VER_PLATFORM_UNKNOWN";
  216. return Map[ i ];
  217. }