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.

159 lines
3.4 KiB

  1. #ifndef _CHECK_DEVICE_H_
  2. #define _CHECK_DEVICE_H_
  3. #include <windows.h>
  4. #include <infnode.h>
  5. #include <setupapi.h>
  6. #include <regstr.h>
  7. #include <wincrypt.h>
  8. #include <wintrust.h>
  9. #include <mscat.h>
  10. #include <softpub.h>
  11. //#define HASH_SIZE 40 // TODO: is this correct???
  12. int __stdcall FindDriverFiles(LPCSTR szDeviceID, LPSTR szBuffer, DWORD dwLength);
  13. UINT __stdcall ScanQueueCallback(PVOID pvContext, UINT Notify, UINT_PTR Param1, UINT_PTR Param2);
  14. BOOL CheckFile (TCHAR *szFileName);
  15. #define WINDOWS_2000_BETA_AUTHORITY "Microsoft Windows 2000 Beta"
  16. #define WINDOWS_2000_REAL_AUTHORITY "Microsoft Windows 2000 Publisher"
  17. #define WINDOWS_ME_REAL_AUTHORITY "Microsoft Consumer Windows Publisher"
  18. struct LogoFileVersion
  19. {
  20. DWORD dwProductVersionLS;
  21. DWORD dwProductVersionMS;
  22. DWORD dwFileVersionLS;
  23. DWORD dwFileVersionMS;
  24. LogoFileVersion();
  25. };
  26. #define pFileVersion *FileVersion
  27. struct CatalogAttribute
  28. {
  29. TCHAR *Attrib;
  30. TCHAR *Value;
  31. void *pNext;
  32. CatalogAttribute();
  33. ~CatalogAttribute();
  34. };
  35. class CheckDevice; //forward declaration
  36. class FileNode
  37. {
  38. friend class CheckDevice;
  39. public:
  40. LogoFileVersion Version;
  41. FILETIME TimeStamp;
  42. ULONG FileSize; // hope no-one makes a driver that is greater in size than 4-gig
  43. BYTE *baHashValue;
  44. DWORD dwHashSize;
  45. BOOL bSigned;
  46. FileNode *pNext;
  47. FileNode();
  48. ~FileNode();
  49. BOOL GetCatalogInfo(LPWSTR lpwzCatName, HCATADMIN hCatAdmin, HCATINFO hCatInfo);
  50. BOOL GetFileInformation(void);
  51. BOOL VerifyFile(void);
  52. BOOL VerifyIsFileSigned(LPTSTR pcszMatchFile, PDRIVER_VER_INFO lpVerInfo);
  53. TCHAR *FileName(void) {return lpszFileName;};
  54. TCHAR *FileExt(void) {return lpszFileExt;};
  55. TCHAR *FilePath(void) {return lpszFilePath;};
  56. TCHAR *CatalogName(void) {return lpszCatalogName;};
  57. TCHAR *CatalogPath(void) {return lpszCatalogPath;};
  58. TCHAR *SignedBy(void) {return lpszSignedBy;};
  59. BOOL GetCertInfo(PCCERT_CONTEXT pCertContext);
  60. CatalogAttribute *m_pCatAttrib;
  61. CheckDevice *pDevnode;
  62. //protected:
  63. TCHAR *lpszFileName; // pointer into lpszFilePath which just contains the filename
  64. TCHAR *lpszFileExt; // pointer into lpszFilePath which just contains the extention
  65. TCHAR *lpszFilePath;
  66. TCHAR *lpszCatalogPath; // name of the catalog which has signed this file (if exitst)
  67. TCHAR *lpszCatalogName;
  68. TCHAR *lpszSignedBy; // name of the signer
  69. };
  70. #define pFileNode *FileNode
  71. class CheckDevice : public InfnodeClass
  72. {
  73. public:
  74. CheckDevice();
  75. CheckDevice(DEVNODE hDevice, DEVNODE hParent);
  76. ~CheckDevice();
  77. BOOL CreateFileNode(void);
  78. BOOL CreateFileNode_Class(void);
  79. BOOL CreateFileNode_Driver(void);
  80. FileNode * GetFileList (void);
  81. BOOL AddFileNode(TCHAR *szFileName , UINT uiWin32Error = 0 , LPCTSTR szSigner = NULL);
  82. BOOL GetServiceNameAndDriver(void);
  83. TCHAR *ServiceName(void) {return lpszServiceName;};
  84. TCHAR *ServiceImage(void) {return lpszServiceImage;};
  85. protected:
  86. FileNode *m_FileList;
  87. HANDLE m_hDevInfo; // this is just to keep the setupapi dll's from coming and going
  88. TCHAR *lpszServiceName;
  89. TCHAR *lpszServiceImage;
  90. private:
  91. };
  92. #define pCheckDevice *CheckDevice
  93. BOOL WalkCertChain(HANDLE hWVTStateData);
  94. #endif // _CHECK_DEVICE_H_
  95. // these lines required by cl.exe