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.

266 lines
8.2 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. #if 0 ///////////////////////////////////////////////////////////////////////
  125. char Buffer[ _MAX_PATH ];
  126. DWORD count;
  127. CLSIDToString( &pClassDetail->Clsid, &Buffer[0] );
  128. fprintf(stream, "\n\t\t\tCLSID = %s", &Buffer[0] );
  129. fwprintf(stream, L"\n\t\t\tDescription = %s", pClassDetail->pszDesc );
  130. fwprintf(stream, L"\n\t\t\tIconPath = %s", pClassDetail->pszIconPath );
  131. // CLSIDToString( &pClassDetail->TypelibID, &Buffer[0] );
  132. // fprintf(stream, "\n\t\t\tTypelibID = %s", &Buffer[0] );
  133. CLSIDToString( &pClassDetail->TreatAsClsid, &Buffer[0] );
  134. fprintf(stream, "\n\t\t\tTreatAsClsid = %s", &Buffer[0] );
  135. CLSIDToString( &pClassDetail->AutoConvertClsid, &Buffer[0] );
  136. fprintf(stream, "\n\t\t\tAutoConvertClsid = %s", &Buffer[0] );
  137. if( pClassDetail->cFileExt )
  138. {
  139. for(count = 0;
  140. count < pClassDetail->cFileExt;
  141. count++
  142. )
  143. {
  144. fwprintf(stream, L"\n\t\t\tFileExt = %s", pClassDetail->prgFileExt[ count ] );
  145. }
  146. }
  147. else
  148. {
  149. fprintf(stream, "\n\t\t\tOtherFileExt = None" );
  150. }
  151. fwprintf(stream, L"\n\t\t\tMimeType = %s", pClassDetail->pMimeType );
  152. fwprintf(stream, L"\n\t\t\tDefaultProgid = %s", pClassDetail->pDefaultProgId );
  153. if( pClassDetail->cOtherProgId )
  154. {
  155. for(count = 0;
  156. count < pClassDetail->cOtherProgId;
  157. count++
  158. )
  159. {
  160. fwprintf(stream, L"\n\t\t\tOtherProgId = %s", pClassDetail->prgOtherProgId[ count ] );
  161. }
  162. }
  163. else
  164. {
  165. fprintf(stream, "\n\t\t\tOtherProgId = None" );
  166. }
  167. fprintf(stream, "\n");
  168. #endif // 0 //////////////////////////////////////////////////////////////////
  169. }
  170. void
  171. DumpOnePackage(
  172. FILE * stream,
  173. PACKAGEDETAIL * p,
  174. CLASSDETAIL * rgClassDetails)
  175. {
  176. #if 0 /////////////////////////////////////////////////////////////////
  177. DWORD count;
  178. // fprintf(stream, "\n++++++++++++++++++++++++++++++++++++++++++++++++++");
  179. fprintf(stream, "ClassPathType = %d", p->PathType );
  180. fwprintf(stream, L"\nPackagePath = %s", p->pszPath );
  181. fwprintf(stream, L"\nIconPath = %s", p->pszIconPath );
  182. fwprintf(stream, L"\nSetup Command = %s", p->pszSetupCommand );
  183. fprintf(stream, "\nActFlags = %d", p->dwActFlags );
  184. fwprintf(stream, L"\nVendor = %s", p->pszVendor );
  185. fwprintf(stream, L"\nPackageName = %s", p->pszPackageName );
  186. fwprintf(stream, L"\nProductName = %s", p->pszProductName );
  187. fwprintf(stream, L"\ndwContext = %d", p->dwContext );
  188. fwprintf(stream, L"\nPlatform.dwProcessorArch = 0x%x", p->Platform.dwProcessorArch );
  189. fwprintf(stream, L"\ndwLocale = 0x%x", p->Locale );
  190. fwprintf(stream, L"\ndwVersionHi = %d", p->dwVersionHi );
  191. fwprintf(stream, L"\ndwVersionLo = %d", p->dwVersionLo );
  192. fwprintf(stream, L"\nCountOfApps = %d", p->cApps );
  193. for( count = 0;
  194. count < p->cApps;
  195. ++count )
  196. {
  197. /*************************
  198. DumpOneAppDetail(stream, &p->pAppDetail[count], rgClassDetails);
  199. **************************/
  200. // advance to the set of class detail structures for the next app
  201. rgClassDetails += p->pAppDetail[count].cClasses;
  202. }
  203. // fprintf(stream, "\n--------------------------------------------------");
  204. #endif // 0 //////////////////////////////////////////////////////////
  205. }
  206. void
  207. DumpOneAppDetail(
  208. FILE * stream,
  209. // APPDETAIL * pA,
  210. void * pA,
  211. CLASSDETAIL * rgClassDetails)
  212. {
  213. #if 0 ///////////////////////////////////////////////////////////////
  214. char Buffer[ 100 ];
  215. DWORD count;
  216. CLSIDToString( &pA->AppID, &Buffer[0] );
  217. fprintf(stream, "\n\t\tAPPID = %s", &Buffer[0] );
  218. if( pA->cClasses )
  219. {
  220. for( count = 0;
  221. count < pA->cClasses;
  222. ++count )
  223. {
  224. DumpOneClass(stream, &rgClassDetails[count]);
  225. }
  226. }
  227. #endif // 0 ////////////////////////////////////////////////////////
  228. }