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.

258 lines
7.7 KiB

  1. #include "precomp.hxx"
  2. char *
  3. StringToULong(
  4. char * pString,
  5. unsigned long * pNumber )
  6. {
  7. unsigned long Number;
  8. int Count;
  9. // There will be 8 characters int a string that converts into a long.
  10. for( Count = 0; Count < 8; ++Count, ++pString )
  11. {
  12. if( (*pString >= '0') && (*pString <= '9' ) )
  13. {
  14. Number = (Number << 4) + (*pString -'0');
  15. }
  16. else if( (*pString >='A') && (*pString <= 'F'))
  17. {
  18. Number = (Number << 4) + (*pString - 'A') + 10;
  19. }
  20. else if( (*pString >='a') && (*pString <= 'f'))
  21. {
  22. Number = (Number << 4) + (*pString - 'a') + 10;
  23. }
  24. }
  25. *pNumber = Number;
  26. return pString;
  27. }
  28. char *
  29. StringToUShort(
  30. char * pString,
  31. unsigned short * pNumber )
  32. {
  33. unsigned short Number;
  34. int Count;
  35. // There will be 4 characters int a string that converts into a short.
  36. for( Count = 0; Count < 4; ++Count, ++pString )
  37. {
  38. if( (*pString >= '0') && (*pString <= '9' ) )
  39. {
  40. Number = (Number << 4) + (*pString -'0');
  41. }
  42. else if( (*pString >='A') && (*pString <= 'F'))
  43. {
  44. Number = (Number << 4) + (*pString - 'A') + 10;
  45. }
  46. else if( (*pString >='a') && (*pString <= 'f'))
  47. {
  48. Number = (Number << 4) + (*pString - 'a') + 10;
  49. }
  50. }
  51. *pNumber = Number;
  52. return pString;
  53. }
  54. char *
  55. StringToUChar(
  56. char * pString,
  57. unsigned char * pNumber )
  58. {
  59. unsigned char Number;
  60. int Count;
  61. // There will be 2 characters int a string that converts into a char.
  62. for( Count = 0; Count < 2; ++Count, ++pString )
  63. {
  64. if( (*pString >= '0') && (*pString <= '9' ) )
  65. {
  66. Number = (Number << 4) + (*pString -'0');
  67. }
  68. else if( (*pString >='A') && (*pString <= 'F'))
  69. {
  70. Number = (Number << 4) + (*pString - 'A') + 10;
  71. }
  72. else if( (*pString >='a') && (*pString <= 'f'))
  73. {
  74. Number = (Number << 4) + (*pString - 'a') + 10;
  75. }
  76. }
  77. *pNumber = Number;
  78. return pString;
  79. }
  80. char *
  81. StringToCLSID(
  82. char * pString,
  83. CLSID * pClsid )
  84. {
  85. pString = StringToULong( pString, &pClsid->Data1 );
  86. pString++; // skip -
  87. pString = StringToUShort( pString, &pClsid->Data2 );
  88. pString++; // skip -
  89. pString = StringToUShort( pString, &pClsid->Data3 );
  90. pString++; // skip -
  91. pString = StringToUChar( pString, &pClsid->Data4[0] );
  92. pString = StringToUChar( pString, &pClsid->Data4[1] );
  93. pString++; // skip -
  94. pString = StringToUChar( pString, &pClsid->Data4[2] );
  95. pString = StringToUChar( pString, &pClsid->Data4[3] );
  96. pString = StringToUChar( pString, &pClsid->Data4[4] );
  97. pString = StringToUChar( pString, &pClsid->Data4[5] );
  98. pString = StringToUChar( pString, &pClsid->Data4[6] );
  99. pString = StringToUChar( pString, &pClsid->Data4[7] );
  100. return pString;
  101. }
  102. void
  103. CLSIDToString(
  104. CLSID * pClsid,
  105. char * pString )
  106. {
  107. sprintf( pString,
  108. "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
  109. pClsid->Data1,
  110. pClsid->Data2,
  111. pClsid->Data3,
  112. pClsid->Data4[0],
  113. pClsid->Data4[1],
  114. pClsid->Data4[2],
  115. pClsid->Data4[3],
  116. pClsid->Data4[4],
  117. pClsid->Data4[5],
  118. pClsid->Data4[6],
  119. pClsid->Data4[7] );
  120. }
  121. void
  122. DumpOneClass(FILE * stream, CLASSDETAIL * pClassDetail )
  123. {
  124. char Buffer[ _MAX_PATH ];
  125. DWORD count;
  126. CLSIDToString( &pClassDetail->Clsid, &Buffer[0] );
  127. fprintf(stream, "\n\t\t\tCLSID = %s", &Buffer[0] );
  128. fwprintf(stream, L"\n\t\t\tDescription = %s", pClassDetail->pszDesc );
  129. fwprintf(stream, L"\n\t\t\tIconPath = %s", pClassDetail->pszIconPath );
  130. // CLSIDToString( &pClassDetail->TypelibID, &Buffer[0] );
  131. // fprintf(stream, "\n\t\t\tTypelibID = %s", &Buffer[0] );
  132. CLSIDToString( &pClassDetail->TreatAsClsid, &Buffer[0] );
  133. fprintf(stream, "\n\t\t\tTreatAsClsid = %s", &Buffer[0] );
  134. CLSIDToString( &pClassDetail->AutoConvertClsid, &Buffer[0] );
  135. fprintf(stream, "\n\t\t\tAutoConvertClsid = %s", &Buffer[0] );
  136. if( pClassDetail->cFileExt )
  137. {
  138. for(count = 0;
  139. count < pClassDetail->cFileExt;
  140. count++
  141. )
  142. {
  143. fwprintf(stream, L"\n\t\t\tFileExt = %s", pClassDetail->prgFileExt[ count ] );
  144. }
  145. }
  146. else
  147. {
  148. fprintf(stream, "\n\t\t\tOtherFileExt = None" );
  149. }
  150. fwprintf(stream, L"\n\t\t\tMimeType = %s", pClassDetail->pMimeType );
  151. fwprintf(stream, L"\n\t\t\tDefaultProgid = %s", pClassDetail->pDefaultProgId );
  152. if( pClassDetail->cOtherProgId )
  153. {
  154. for(count = 0;
  155. count < pClassDetail->cOtherProgId;
  156. count++
  157. )
  158. {
  159. fwprintf(stream, L"\n\t\t\tOtherProgId = %s", pClassDetail->prgOtherProgId[ count ] );
  160. }
  161. }
  162. else
  163. {
  164. fprintf(stream, "\n\t\t\tOtherProgId = None" );
  165. }
  166. fprintf(stream, "\n");
  167. }
  168. void
  169. DumpOnePackage(
  170. FILE * stream,
  171. PACKAGEDETAIL * p,
  172. CLASSDETAIL * rgClassDetails)
  173. {
  174. DWORD count;
  175. // fprintf(stream, "\n++++++++++++++++++++++++++++++++++++++++++++++++++");
  176. fprintf(stream, "ClassPathType = %d", p->PathType );
  177. fwprintf(stream, L"\nPackagePath = %s", p->pszPath );
  178. fwprintf(stream, L"\nIconPath = %s", p->pszIconPath );
  179. fwprintf(stream, L"\nSetup Command = %s", p->pszSetupCommand );
  180. fprintf(stream, "\nActFlags = %d", p->dwActFlags );
  181. fwprintf(stream, L"\nVendor = %s", p->pszVendor );
  182. fwprintf(stream, L"\nPackageName = %s", p->pszPackageName );
  183. fwprintf(stream, L"\nProductName = %s", p->pszProductName );
  184. fwprintf(stream, L"\ndwContext = %d", p->dwContext );
  185. fwprintf(stream, L"\nPlatform.dwProcessorArch = 0x%x", p->Platform.dwProcessorArch );
  186. fwprintf(stream, L"\ndwLocale = 0x%x", p->Locale );
  187. fwprintf(stream, L"\ndwVersionHi = %d", p->dwVersionHi );
  188. fwprintf(stream, L"\ndwVersionLo = %d", p->dwVersionLo );
  189. fwprintf(stream, L"\nCountOfApps = %d", p->cApps );
  190. for( count = 0;
  191. count < p->cApps;
  192. ++count )
  193. {
  194. DumpOneAppDetail(stream, &p->pAppDetail[count], rgClassDetails);
  195. // advance to the set of class detail structures for the next app
  196. rgClassDetails += p->pAppDetail[count].cClasses;
  197. }
  198. // fprintf(stream, "\n--------------------------------------------------");
  199. }
  200. void
  201. DumpOneAppDetail(
  202. FILE * stream,
  203. APPDETAIL * pA,
  204. CLASSDETAIL * rgClassDetails)
  205. {
  206. char Buffer[ 100 ];
  207. DWORD count;
  208. CLSIDToString( &pA->AppID, &Buffer[0] );
  209. fprintf(stream, "\n\t\tAPPID = %s", &Buffer[0] );
  210. if( pA->cClasses )
  211. {
  212. for( count = 0;
  213. count < pA->cClasses;
  214. ++count )
  215. {
  216. DumpOneClass(stream, &rgClassDetails[count]);
  217. }
  218. }
  219. }