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.

795 lines
19 KiB

  1. #include <windows.h>
  2. #include <winnt.h>
  3. #include <imagehlp.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. LOADED_IMAGE Image;
  7. int __cdecl CompareNames (const void *pv1, const void *pv2)
  8. {
  9. return(strcmp((const char *)pv1, *(const char **)pv2));
  10. }
  11. char *rgszBetaAPIs[] = {
  12. "ABProviderInit",
  13. "AddInksetInterval",
  14. "AddPenDataHRC",
  15. "AddPenInputHRC",
  16. "AddPointsPenData",
  17. "AddPropertySheet",
  18. "AddWordsHWL",
  19. "AnimateProc",
  20. "AssociateProperties",
  21. "AtomicVirtualEvent",
  22. "BeginEnumStrokes",
  23. "BoundingRectFromPoints",
  24. "BroadcastSystemMessage",
  25. "BrowseCallbackProc",
  26. "BuildDisplayTable",
  27. "CallWndRetProc",
  28. "CascadeWindows",
  29. "ChangeIdleRoutine",
  30. "CharacterToSymbol",
  31. "CheckColorsInGamut",
  32. "CheckMenuRadioItem",
  33. "CheckParameters",
  34. "CloseIMsgSession",
  35. "CloseProperties",
  36. "ColorMatchToTarget",
  37. "CommConfigDialog",
  38. "CompactPenData",
  39. "CompressPenData",
  40. "ConfigHREC",
  41. "ConfigRecognizer",
  42. "CopyImage",
  43. "CorrectWriting",
  44. "CorrectWritingEx",
  45. "CreateColorSpace",
  46. "CreateCompatibleHRC",
  47. "CreateHWL",
  48. "CreateIProp",
  49. "CreateIconFromResourceEx",
  50. "CreateInkset",
  51. "CreateInksetHRCRESULT",
  52. "CreatePenData",
  53. "CreatePenDataEx",
  54. "CreatePenDataHRC",
  55. "CreatePenDataRegion",
  56. "CreateTable",
  57. "CreateToolhelp32Snapshot",
  58. "DPtoTP",
  59. "DeleteColorSpace",
  60. "DeregisterIdleRoutine",
  61. "DestroyHRC",
  62. "DestroyHRCRESULT",
  63. "DestroyHWL",
  64. "DestroyInkset",
  65. "DestroyPenData",
  66. "DictionarySearch",
  67. "DisplayGuesses",
  68. "DoDefaultPenInput",
  69. "DrawAnimatedRects",
  70. "DrawArrow",
  71. "DrawCaption",
  72. "DrawMirrorImage",
  73. "DrawPenData",
  74. "DrawPenDataEx",
  75. "DrawPenDataFmt",
  76. "DrawState",
  77. "DrawStateProc",
  78. "DrawTextEx",
  79. "DuplicatePenData",
  80. "EditProperties",
  81. "EmulatePen",
  82. "EnableGestureSetHRC",
  83. "EnableIdleRoutine",
  84. "EnableSystemDictionaryHRC",
  85. "EndEnumStrokes",
  86. "EndPenInputHRC",
  87. "EnumFontFamExProc",
  88. "EnumFontFamiliesEx",
  89. "EnumICMProfiles",
  90. "EnumICMProfilesProc",
  91. "EnumProperties",
  92. "EnumPropertyLibs",
  93. "EnumPropertySheets",
  94. "EnumRegisterWordProc",
  95. "EnumSymbols",
  96. "EnumSymbolsCallback",
  97. "ExtractPenDataPoints",
  98. "ExtractPenDataStrokes",
  99. "FAbsTimeInInterval",
  100. "FBadColumnSet",
  101. "FBadEntryList",
  102. "FBadProp",
  103. "FBadPropTag",
  104. "FBadRestriction",
  105. "FBadRglpNameID",
  106. "FBadRglpszW",
  107. "FBadRow",
  108. "FBadRowSet",
  109. "FBadSortOrderSet",
  110. "FBinFromHex",
  111. "FEQAbsTime",
  112. "FEqualNames",
  113. "FIntervalInInterval",
  114. "FIntervalXInterval",
  115. "FLEAbsTime",
  116. "FLTAbsTime",
  117. "FPropCompareProp",
  118. "FPropContainsProp",
  119. "FPropExists",
  120. "FindWindowEx",
  121. "FirstSymbolFromGraph",
  122. "FlushProperties",
  123. "FreeImageColorMatcher",
  124. "FreePadrlist",
  125. "FreePropertyLib",
  126. "FreePropertySheets",
  127. "FreeProws",
  128. "FtAddFt",
  129. "FtMulDw",
  130. "FtMulDwDw",
  131. "FtNegFt",
  132. "FtSubFt",
  133. "FtgRegisterIdleRoutine",
  134. "GetAlphabetHRC",
  135. "GetAlphabetPriorityHRC",
  136. "GetAlternateWordsHRCRESULT",
  137. "GetAttribIMsgOnIStg",
  138. "GetBoxMappingHRCRESULT",
  139. "GetBoxResultsHRC",
  140. "GetCharacterPlacement",
  141. "GetClassInfoEx",
  142. "GetColorSpace",
  143. "GetCommConfig",
  144. "GetDefaultCommConfig",
  145. "GetDeviceGammaRamp",
  146. "GetFontLanguageInfo",
  147. "GetGlobalRC",
  148. "GetGuideHRC",
  149. "GetHRECFromHRC",
  150. "GetHotspotsHRCRESULT",
  151. "GetICMProfile",
  152. "GetInksetInterval",
  153. "GetInksetIntervalCount",
  154. "GetInstance",
  155. "GetInternationalHRC",
  156. "GetKeyboardLayout",
  157. "GetKeyboardLayoutList",
  158. "GetLogColorSpace",
  159. "GetMaxResultsHRC",
  160. "GetMenuDefaultItem",
  161. "GetMenuItemInfo",
  162. "GetMenuItemRect",
  163. "GetPenAppFlags",
  164. "GetPenAsyncState",
  165. "GetPenDataAttributes",
  166. "GetPenDataInfo",
  167. "GetPenDataStroke",
  168. "GetPenHwEventData",
  169. "GetPenInput",
  170. "GetPenMiscInfo",
  171. "GetPenResource",
  172. "GetPointsFromPenData",
  173. "GetProperties",
  174. "GetResultsHRC",
  175. "GetStrokeAttributes",
  176. "GetStrokeTableAttributes",
  177. "GetSymbolCount",
  178. "GetSymbolCountHRCRESULT",
  179. "GetSymbolMaxLength",
  180. "GetSymbolsHRCRESULT",
  181. "GetSysColorBrush",
  182. "GetSystemPowerStatus",
  183. "GetTextCharsetInfo",
  184. "GetVersionPenWin",
  185. "GetWordlistCoercionHRC",
  186. "GetWordlistHRC",
  187. "HPProviderInit",
  188. "Heap32First",
  189. "Heap32ListFirst",
  190. "Heap32ListNext",
  191. "Heap32Next",
  192. "HexFromBin",
  193. "HitTestPenData",
  194. "HrAddColumnsEx",
  195. "HrAllocAdviseSink",
  196. "HrComposeEID",
  197. "HrComposeMsgID",
  198. "HrDecomposeEID",
  199. "HrDecomposeMsgID",
  200. "HrEntryIDFromSz",
  201. "HrGetOneProp",
  202. "HrIStorageFromStream",
  203. "HrQueryAllRows",
  204. "HrSetOneProp",
  205. "HrSzFromEntryID",
  206. "HrThisThreadAdviseSink",
  207. "HrValidateIPMSubtree",
  208. "ImmAssociateContext",
  209. "ImmConfigureIME",
  210. "ImmCreateContext",
  211. "ImmDestroyContext",
  212. "ImmEnumRegisterWord",
  213. "ImmEscape",
  214. "ImmGetCandidateList",
  215. "ImmGetCandidateListCount",
  216. "ImmGetCandidateWindow",
  217. "ImmGetCompositionFont",
  218. "ImmGetCompositionString",
  219. "ImmGetCompositionWindow",
  220. "ImmGetContext",
  221. "ImmGetConversionList",
  222. "ImmGetConversionStatus",
  223. "ImmGetDefaultIMEWnd",
  224. "ImmGetDescription",
  225. "ImmGetGuideLine",
  226. "ImmGetIMEFileName",
  227. "ImmGetOpenStatus",
  228. "ImmGetProperty",
  229. "ImmGetRegisterWordStyle",
  230. "ImmGetStatusWindowPos",
  231. "ImmGetVirtualKey",
  232. "ImmInstallIME",
  233. "ImmIsIME",
  234. "ImmIsUIMessage",
  235. "ImmNotifyIME",
  236. "ImmRegisterWord",
  237. "ImmReleaseContext",
  238. "ImmSetCandidateWindow",
  239. "ImmSetCompositionFont",
  240. "ImmSetCompositionString",
  241. "ImmSetCompositionWindow",
  242. "ImmSetConversionStatus",
  243. "ImmSetOpenStatus",
  244. "ImmSetStatusWindowPos",
  245. "ImmSimulateHotKey",
  246. "ImmUnregisterWord",
  247. "InfoWndProc",
  248. "InitRC",
  249. "InputWndProc",
  250. "InsertMenuItem",
  251. "InsertPenData",
  252. "InsertPenDataPoints",
  253. "InsertPenDataStroke",
  254. "InstallRecognizer",
  255. "IsPenAware",
  256. "IsPenEvent",
  257. "KKConvert",
  258. "LPropCompareProp",
  259. "LaunchWizard",
  260. "LoadImage",
  261. "LoadImageColorMatcher",
  262. "LoadPropertyLib",
  263. "LoadPropertySheets",
  264. "LookupIconIdFromDirectoryEx",
  265. "MAPIAddress",
  266. "MAPIAdminProfiles",
  267. "MAPIAllocateBuffer",
  268. "MAPIAllocateMore",
  269. "MAPIDeInitIdle",
  270. "MAPIDeleteMail",
  271. "MAPIDetails",
  272. "MAPIFindNext",
  273. "MAPIFreeBuffer",
  274. "MAPIGetDefaultMalloc",
  275. "MAPIInitIdle",
  276. "MAPIInitialize",
  277. "MAPILogoff",
  278. "MAPILogon",
  279. "MAPILogonEx",
  280. "MAPIMessage",
  281. "MAPIOpenFormMgr",
  282. "MAPIOpenLocalFormContainer",
  283. "MAPIReadMail",
  284. "MAPIRecip",
  285. "MAPIResolveName",
  286. "MAPISaveMail",
  287. "MAPISendDocuments",
  288. "MAPISendMail",
  289. "MAPIUnintialize",
  290. "MSProviderInit",
  291. "MakeAbsTime",
  292. "MapStorageSCode",
  293. "MapVirtualKeyEx",
  294. "MapiFile",
  295. "MapiFileDesc",
  296. "MapiFileTagExt",
  297. "MapiMessage",
  298. "MapiRecipDesc",
  299. "MenuItemFromPoint",
  300. "MessageBoxIndirect",
  301. "MetricScalePenData",
  302. "Module32First",
  303. "Module32Next",
  304. "OffsetPenData",
  305. "OpenIMsgOnIStg",
  306. "OpenIMsgOnIStorage",
  307. "OpenIMsgSession",
  308. "OpenProperties",
  309. "OpenStreamOnFile",
  310. "OpenTnefStream",
  311. "OpenTnefStreamEx",
  312. "PPChangePassword",
  313. "PPGetPasswordStatus",
  314. "PaintDesktop",
  315. "PeekPenInput",
  316. "PenDataFromBuffer",
  317. "PenDataToBuffer",
  318. "PostVirtualKeyEvent",
  319. "PostVirtualMouseEvent",
  320. "PpropFindProp",
  321. "PreprocessMessage",
  322. "Process32First",
  323. "Process32Next",
  324. "ProcessHRC",
  325. "ProcessWriting",
  326. "PropCopyMore",
  327. "PwdChangePassword",
  328. "PwdGetPasswordStatus",
  329. "PwdSetPasswordStatus",
  330. "RTFSync",
  331. "RawWndProc",
  332. "ReadHWL",
  333. "Recognize",
  334. "RecognizeData",
  335. "RedisplayPenData",
  336. "RegisterClassEx",
  337. "RegisterPenApp",
  338. "RemovePenDataStrokes",
  339. "RemovePreprocessInfo",
  340. "RemovePropertySheet",
  341. "ResizePenData",
  342. "ResultsHookHREC",
  343. "SAVEOPTS",
  344. "SAndRestriction",
  345. "SAppTimeArray",
  346. "SBinary",
  347. "SBinaryArray",
  348. "SBitMaskRestriction",
  349. "SCommentRestriction",
  350. "SComparePropsRestriction",
  351. "SContentRestriction",
  352. "SCurrencyArray",
  353. "SDateTimeArray",
  354. "SDoubleArray",
  355. "SExistRestriction",
  356. "SGuidArray",
  357. "SHAddToRecentDocs",
  358. "SHAppBarMessage",
  359. "SHBrowseForFolder",
  360. "SHChangeNotify",
  361. "SHFileOperation",
  362. "SHFreeNameMappings",
  363. "SHGetDesktopFolder",
  364. "SHGetFileInfo",
  365. "SHGetInstanceExplorer",
  366. "SHGetMalloc",
  367. "SHGetNameMappingCount",
  368. "SHGetNameMappingPtr",
  369. "SHGetPathFromIDList",
  370. "SHGetSpecialFolderLocation",
  371. "SHLoadInProc",
  372. "SLPSTRArray",
  373. "SLargeIntegerArray",
  374. "SLongArray",
  375. "SMAPIFormInfoArray",
  376. "SMAPIFormProp",
  377. "SMAPIFormPropArray",
  378. "SMAPIFormPropEnumVal",
  379. "SMAPIVerb",
  380. "SMAPIVerbArray",
  381. "SMessageClassArray",
  382. "SNotRestriction",
  383. "SOBailOut",
  384. "SOBeginTable",
  385. "SOEndColumnInfo",
  386. "SOEndFieldInfo",
  387. "SOEndFontTable",
  388. "SOEndPalette",
  389. "SOEndTabStops",
  390. "SOEndTable",
  391. "SOGetInfo",
  392. "SOGetScanLineBuffer",
  393. "SOPutBitmapHeader",
  394. "SOPutBreak",
  395. "SOPutChar",
  396. "SOPutCharAttr",
  397. "SOPutCharFontById",
  398. "SOPutCharFontByName",
  399. "SOPutCharHeight",
  400. "SOPutCharX",
  401. "SOPutColumnInfo",
  402. "SOPutDataCell",
  403. "SOPutEmbeddedObject",
  404. "SOPutField",
  405. "SOPutFieldInfo",
  406. "SOPutFontTableEntry",
  407. "SOPutHdrEntry",
  408. "SOPutMoreText",
  409. "SOPutMoreVarField",
  410. "SOPutPaletteEntry",
  411. "SOPutParaAlign",
  412. "SOPutParaIndents",
  413. "SOPutParaMargins",
  414. "SOPutParaSpacing",
  415. "SOPutScanLineData",
  416. "SOPutSectionName",
  417. "SOPutSectionType",
  418. "SOPutSpecialCharX",
  419. "SOPutSubdocInfo",
  420. "SOPutTabStop",
  421. "SOPutTableCellInfo",
  422. "SOPutTableRowFormat",
  423. "SOPutTextCell",
  424. "SOPutVarField",
  425. "SOPutVectorHeader",
  426. "SOSetDateBase",
  427. "SOStartColumnInfo",
  428. "SOStartFieldInfo",
  429. "SOStartFontTable",
  430. "SOStartPalette",
  431. "SOStartTabStops",
  432. "SOVectorAttr",
  433. "SOVectorObject",
  434. "SOrRestriction",
  435. "SPropAttrArray",
  436. "SPropProblem",
  437. "SPropProblemArray",
  438. "SPropTagArray",
  439. "SPropValue",
  440. "SPropertyRestriction",
  441. "SRealArray",
  442. "SRestriction",
  443. "SRow",
  444. "SRowSet",
  445. "SShortArray",
  446. "SSizeRestriction",
  447. "SSortOrder",
  448. "SSortOrderSet",
  449. "SSubRestriction",
  450. "STnefProblem",
  451. "STnefProblemArray",
  452. "SUUserPopData",
  453. "SUUserPushData",
  454. "SUUserRetrieveData",
  455. "SUUserSaveData",
  456. "SWStringArray",
  457. "ScBinFromHexBounded",
  458. "ScCopyNotifications",
  459. "ScCopyProps",
  460. "ScCountNotifications",
  461. "ScCountProps",
  462. "ScDupPropset",
  463. "ScLocalPathFromUNC",
  464. "ScRelocNotifications",
  465. "ScRelocProps",
  466. "ScUNCFromLocalPath",
  467. "SetAlphabetHRC",
  468. "SetAlphabetPriorityHRC",
  469. "SetAttribIMsgOnIStg",
  470. "SetBoxAlphabetHRC",
  471. "SetColorSpace",
  472. "SetCommConfig",
  473. "SetDefaultCommConfig",
  474. "SetDeviceGammaRamp",
  475. "SetGlobalRC",
  476. "SetGuideHRC",
  477. "SetICMMode",
  478. "SetICMProfile",
  479. "SetInternationalHRC",
  480. "SetMaxResultsHRC",
  481. "SetMenuDefaultItem",
  482. "SetMenuItemInfo",
  483. "SetMessageExtraInfo",
  484. "SetPenAppFlags",
  485. "SetPenHook",
  486. "SetPenHookCallback",
  487. "SetPenMiscInfo",
  488. "SetProperties",
  489. "SetRecogHook",
  490. "SetResultsHookHREC",
  491. "SetStrokeAttributes",
  492. "SetStrokeTableAttributes",
  493. "SetSystemPowerState",
  494. "SetWordlistCoercionHRC",
  495. "SetWordlistHRC",
  496. "Shell_NotifyIcon",
  497. "ShowKeyboard",
  498. "ShowWindowAsync",
  499. "StartInking",
  500. "StartPenInput",
  501. "StopInking",
  502. "StopPenInput",
  503. "SymbolToCharacter",
  504. "TPtoDP",
  505. "TargetPoints",
  506. "Thread32First",
  507. "Thread32Next",
  508. "TileWindows",
  509. "ToAsciiEx",
  510. "Toolhelp32ReadProcessMemory",
  511. "TrackPopupMenuEx",
  512. "TrainContext",
  513. "TrainHREC",
  514. "TrainInk",
  515. "TranslateCharsetInfo",
  516. "TrimPenData",
  517. "UnhookResultsHookHREC",
  518. "UninstallRecognizer",
  519. "UpdatePenInfo",
  520. "ValidateParameters",
  521. "VkKeyScanEx",
  522. "VwStreamCloseFunc",
  523. "VwStreamOpenFunc",
  524. "VwStreamReadFunc",
  525. "VwStreamReadRecordFunc",
  526. "VwStreamSectionFunc",
  527. "VwStreamSeekFunc",
  528. "VwStreamTellFunc",
  529. "WrapCompressedRTFStream",
  530. "WrapStoreEntryID",
  531. "WriteHWL",
  532. "XPProviderInit",
  533. "attAttachRenddata",
  534. "attConversationID",
  535. "attFrom",
  536. "attMAPIProps",
  537. "attMessageStatus",
  538. "attOriginalMessageClass",
  539. "attOwner",
  540. "attParentID",
  541. "attPriority",
  542. "attRecipTable",
  543. "attSentFor",
  544. "dwDiffAT",
  545. "dwDurInterval",
  546. "lineAccept",
  547. "lineAddProvider",
  548. "lineAddToConference",
  549. "lineAnswer",
  550. "lineBlindTransfer",
  551. "lineCallbackFunc",
  552. "lineClose",
  553. "lineCompleteCall",
  554. "lineCompleteTransfer",
  555. "lineConfigDialog",
  556. "lineConfigDialogEdit",
  557. "lineConfigProvider",
  558. "lineDeallocateCall",
  559. "lineDevSpecific",
  560. "lineDevSpecificFeature",
  561. "lineDial",
  562. "lineDrop",
  563. "lineForward",
  564. "lineGatherDigits",
  565. "lineGenerateDigits",
  566. "lineGenerateTone",
  567. "lineGetAddressCaps",
  568. "lineGetAddressID",
  569. "lineGetAddressStatus",
  570. "lineGetAppPriority",
  571. "lineGetCallInfo",
  572. "lineGetCallStatus",
  573. "lineGetConfRelatedCalls",
  574. "lineGetCountry",
  575. "lineGetDevCaps",
  576. "lineGetDevConfig",
  577. "lineGetID",
  578. "lineGetIcon",
  579. "lineGetLineDevStatus",
  580. "lineGetNewCalls",
  581. "lineGetNumRings",
  582. "lineGetProviderList",
  583. "lineGetRequest",
  584. "lineGetStatusMessages",
  585. "lineGetTranslateCaps",
  586. "lineHandoff",
  587. "lineHold",
  588. "lineInitialize",
  589. "lineMakeCall",
  590. "lineMonitorDigits",
  591. "lineMonitorMedia",
  592. "lineMonitorTones",
  593. "lineNegotiateAPIVersion",
  594. "lineNegotiateExtVersion",
  595. "lineOpen",
  596. "linePark",
  597. "linePickup",
  598. "linePrepareAddToConference",
  599. "lineRedirect",
  600. "lineRegisterRequestRecipient",
  601. "lineReleaseUserUserInfo",
  602. "lineRemoveFromConference",
  603. "lineRemoveProvider",
  604. "lineSecureCall",
  605. "lineSendUserUserInfo",
  606. "lineSetAppPriority",
  607. "lineSetAppSpecific",
  608. "lineSetCallParams",
  609. "lineSetCallPrivilege",
  610. "lineSetCurrentLocation",
  611. "lineSetDevConfig",
  612. "lineSetMediaControl",
  613. "lineSetMediaMode",
  614. "lineSetNumRings",
  615. "lineSetStatusMessages",
  616. "lineSetTerminal",
  617. "lineSetTollList",
  618. "lineSetupConference",
  619. "lineSetupTransfer",
  620. "lineShutdown",
  621. "lineSwapHold",
  622. "lineTranslateAddress",
  623. "lineTranslateDialog",
  624. "lineUncompleteCall",
  625. "lineUnhold",
  626. "lineUnpark",
  627. "phoneCallbackFunc",
  628. "phoneClose",
  629. "phoneConfigDialog",
  630. "phoneDevSpecific",
  631. "phoneGetButtonInfo",
  632. "phoneGetData",
  633. "phoneGetDevCaps",
  634. "phoneGetDisplay",
  635. "phoneGetGain",
  636. "phoneGetHookSwitch",
  637. "phoneGetID",
  638. "phoneGetIcon",
  639. "phoneGetLamp",
  640. "phoneGetRing",
  641. "phoneGetStatus",
  642. "phoneGetStatusMessages",
  643. "phoneGetVolume",
  644. "phoneInitialize",
  645. "phoneNegotiateAPIVersion",
  646. "phoneNegotiateExtVersion",
  647. "phoneOpen",
  648. "phoneSetButtonInfo",
  649. "phoneSetData",
  650. "phoneSetDisplay",
  651. "phoneSetGain",
  652. "phoneSetHookSwitch",
  653. "phoneSetLamp",
  654. "phoneSetRing",
  655. "phoneSetStatusMessages",
  656. "phoneSetVolume",
  657. "phoneShutdown",
  658. "tapiGetLocationInfo",
  659. "tapiRequestDrop",
  660. "tapiRequestMakeCall",
  661. "tapiRequestMediaCall",
  662. "ulValidateParameters"
  663. };
  664. BOOL
  665. VerifyImageImports(
  666. char *ImageName
  667. );
  668. void __cdecl
  669. main(
  670. int argc,
  671. char *argv[]
  672. )
  673. {
  674. int i;
  675. if (argc < 2 ||
  676. (((argv[1][0] == '/') || (argv[1][0] == '-')) &&
  677. (argv[1][1] == '?'))) {
  678. puts("Usage: impchk <imagename>\n"
  679. " where <imagename> is the image you want to check for beta API's");
  680. } else {
  681. i = 0;
  682. while (argc > 1) {
  683. argc--;
  684. i++;
  685. printf("Image: \"%s\" should %s marked as Beta\n",
  686. argv[i],
  687. VerifyImageImports(argv[i]) ? "be" : "not be");
  688. }
  689. }
  690. }
  691. BOOL
  692. VerifyImageImports(
  693. char *ImageName
  694. )
  695. {
  696. PIMAGE_IMPORT_DESCRIPTOR Imports;
  697. PIMAGE_THUNK_DATA tname;
  698. PIMAGE_THUNK_DATA ThunkNames;
  699. PIMAGE_IMPORT_BY_NAME ImportName;
  700. ULONG NumberOfThunks;
  701. ULONG i, cb;
  702. UCHAR NameBuffer[ 32 ];
  703. PIMAGE_NT_HEADERS NtHeaders;
  704. ULONG ImportSize;
  705. LPSTR ImportModule;
  706. BOOL rc = FALSE;
  707. if (MapAndLoad(ImageName, ".", &Image, TRUE, TRUE)) {
  708. Image.ModuleName = ImageName;
  709. //
  710. // Now locate and walk through and process the images imports
  711. //
  712. NtHeaders = ImageNtHeader( (PVOID)Image.MappedAddress );
  713. if (NtHeaders != NULL) {
  714. Imports = (PIMAGE_IMPORT_DESCRIPTOR)ImageDirectoryEntryToData(
  715. (PVOID)Image.MappedAddress,
  716. FALSE,
  717. IMAGE_DIRECTORY_ENTRY_IMPORT,
  718. &ImportSize
  719. );
  720. for(;Imports;Imports++) {
  721. if (!Imports->Name) {
  722. break;
  723. }
  724. ImportModule = (LPSTR) ImageRvaToVa( (PIMAGE_NT_HEADERS) Image.FileHeader,
  725. Image.MappedAddress,
  726. (ULONG) Imports->Name,
  727. &Image.LastRvaSection);
  728. if (ImportModule) {
  729. ThunkNames = (PIMAGE_THUNK_DATA) ImageRvaToVa(
  730. (PIMAGE_NT_HEADERS)Image.FileHeader,
  731. Image.MappedAddress,
  732. (ULONG) Imports->OriginalFirstThunk,
  733. &Image.LastRvaSection);
  734. if (!ThunkNames || ThunkNames->u1.Function == 0) {
  735. //
  736. // Skip this one if no thunks or first thunk is the terminating null thunk
  737. //
  738. continue;
  739. }
  740. //
  741. NumberOfThunks = 0;
  742. tname = ThunkNames;
  743. while (tname->u1.AddressOfData) {
  744. NumberOfThunks++;
  745. tname++;
  746. }
  747. tname = ThunkNames;
  748. for(i=0;i<NumberOfThunks;i++) {
  749. if (!(BOOL)IMAGE_SNAP_BY_ORDINAL(tname->u1.Ordinal)) {
  750. ImportName = (PIMAGE_IMPORT_BY_NAME)
  751. ImageRvaToVa((PIMAGE_NT_HEADERS)Image.FileHeader,
  752. Image.MappedAddress,
  753. (ULONG)(ULONG_PTR) tname->u1.AddressOfData,
  754. &Image.LastRvaSection);
  755. if (bsearch(ImportName->Name,
  756. rgszBetaAPIs,
  757. sizeof(rgszBetaAPIs) / sizeof(char *),
  758. sizeof(char *),
  759. CompareNames
  760. )) {
  761. printf("%s: Imports \"%s\" from \"%s\"\n",
  762. ImageName,
  763. ImportName->Name,
  764. ImportModule);
  765. rc = TRUE;
  766. }
  767. }
  768. tname++;
  769. }
  770. }
  771. }
  772. }
  773. UnMapAndLoad(&Image);
  774. }
  775. return(rc);
  776. }