Changeset 4249 for trunk/src/kernel32/winimagebase.h
- Timestamp:
- Sep 13, 2000, 12:45:19 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagebase.h
r4224 r4249 1 /* $Id: winimagebase.h,v 1.1 5 2000-09-08 18:07:51 sandervlExp $ */1 /* $Id: winimagebase.h,v 1.16 2000-09-12 22:45:19 bird Exp $ */ 2 2 3 3 /* … … 5 5 * 6 6 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl) 7 * Copyright 1999-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no) 7 8 * 8 9 * … … 41 42 class Win32DllBase; 42 43 44 43 45 class Win32ImageBase 44 46 { … … 46 48 DWORD magic; 47 49 public: 48 49 50 if(magic != MAGIC_WINIMAGE) {51 52 53 54 50 void checkObject() 51 { 52 if (magic != MAGIC_WINIMAGE) { 53 eprintf(("Corrupt this pointer %X %X!!", this, magic)); 54 DebugInt3(); 55 } 56 }; 55 57 56 58 public: … … 59 61 virtual ~Win32ImageBase(); 60 62 61 62 63 ULONG getError() { return errorState; }; 64 HINSTANCE getInstanceHandle() { return hinstance; }; 63 65 64 66 //Returns required OS version for this image … … 66 68 67 69 virtual void setFullPath(char *name); 68 char *getFullPath() { return fullpath; }; 69 70 char *getModuleName() { return szModule; }; 70 char *getFullPath() { return fullpath; }; 71 char *getModuleName() { return szModule; }; 71 72 72 73 //findResource returns the pointer of the resource's IMAGE_RESOURCE_DATA_ENTRY structure 73 74 74 HRSRC findResourceA(LPCSTR lpszName, LPSTR lpszType, ULONG lang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)); 75 HRSRC findResourceW(LPWSTR lpszName, LPWSTR lpszType, ULONG lang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)); 75 76 76 77 78 79 80 BOOL enumResourceTypesA(HMODULE hmod, ENUMRESTYPEPROCA lpEnumFunc, 81 82 BOOL enumResourceTypesW(HMODULE hmod, ENUMRESTYPEPROCW lpEnumFunc, 83 84 BOOL enumResourceLanguagesA(HMODULE hmod, LPCSTR lpType, LPCSTR lpName, 85 86 BOOL enumResourceLanguagesW(HMODULE hmod, LPCWSTR lpType, LPCWSTR lpName, 87 77 ULONG getResourceSizeA(LPSTR lpszName, LPSTR lpszType, ULONG lang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)); 78 ULONG getResourceSizeW(LPWSTR lpszName, LPWSTR lpszType, ULONG lang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)); 79 BOOL enumResourceNamesA(HMODULE hmod, LPCTSTR lpszType, ENUMRESNAMEPROCA lpEnumFunc, LONG lParam); 80 BOOL enumResourceNamesW(HMODULE hmod, LPCWSTR lpszType, ENUMRESNAMEPROCW lpEnumFunc, LONG lParam); 81 BOOL enumResourceTypesA(HMODULE hmod, ENUMRESTYPEPROCA lpEnumFunc, 82 LONG lParam); 83 BOOL enumResourceTypesW(HMODULE hmod, ENUMRESTYPEPROCW lpEnumFunc, 84 LONG lParam); 85 BOOL enumResourceLanguagesA(HMODULE hmod, LPCSTR lpType, LPCSTR lpName, 86 ENUMRESLANGPROCA lpEnumFunc, LONG lParam); 87 BOOL enumResourceLanguagesW(HMODULE hmod, LPCWSTR lpType, LPCWSTR lpName, 88 ENUMRESLANGPROCW lpEnumFunc, LONG lParam); 88 89 89 90 90 ULONG getVersionSize(); 91 BOOL getVersionStruct(char *verstruct, ULONG bufLength); 91 92 92 93 94 93 //Returns pointer to data of resource handle 94 char *getResourceAddr(HRSRC hResource); 95 ULONG getResourceSize(HRSRC hResource); 95 96 96 97 //returns ERROR_SUCCESS or error code 97 98 static ULONG isPEImage(char *szFileName); 98 99 static BOOL findDll(const char *pszFileName, char *pszFullName, 99 100 int cchFullName, const char *pszAltPath = NULL); 100 101 101 void setEntryPoint(ULONG startAddress){ entryPoint = startAddress; };102 void setEntryPoint(ULONG startAddress) { entryPoint = startAddress; }; 102 103 103 void setTLSAddress(LPVOID dwTlsAddress){ tlsAddress = dwTlsAddress; };104 void setTLSIndexAddr(LPDWORD dwTlsIndexAddr){ tlsIndexAddr = dwTlsIndexAddr; };105 void setTLSInitSize(ULONG dwTlsSize){ tlsInitSize = dwTlsSize; };106 void setTLSTotalSize(ULONG dwTlsSize){ tlsTotalSize = dwTlsSize; };107 108 109 110 104 void setTLSAddress(LPVOID dwTlsAddress) { tlsAddress = dwTlsAddress; }; 105 void setTLSIndexAddr(LPDWORD dwTlsIndexAddr) { tlsIndexAddr = dwTlsIndexAddr; }; 106 void setTLSInitSize(ULONG dwTlsSize) { tlsInitSize = dwTlsSize; }; 107 void setTLSTotalSize(ULONG dwTlsSize) { tlsTotalSize = dwTlsSize; }; 108 void setTLSCallBackAddr(PIMAGE_TLS_CALLBACK *dwTlsCallBackAddr) 109 { 110 tlsCallBackAddr = dwTlsCallBackAddr; 111 }; 111 112 112 void tlsAttachThread();//setup TLS structures for new thread113 void tlsDetachThread();//destroy TLS structures113 void tlsAttachThread(); //setup TLS structures for new thread 114 void tlsDetachThread(); //destroy TLS structures 114 115 115 116 virtual BOOL insideModule(ULONG address); 116 117 virtual BOOL insideModuleCode(ULONG address); 117 118 118 virtual 119 virtual ULONG getApi(char *name) = 0; 119 120 virtual ULONG getApi(int ordinal) = 0; 120 121 … … 124 125 125 126 static Win32ImageBase * findModule(HMODULE hModule); 127 BOOL matchModName(const char *pszFilename) const; 126 128 127 //Add image to dependency list of this image 128 void addDependency(Win32DllBase *dll); 129 BOOL dependsOn(Win32DllBase *dll); 129 /* @cat Depencies */ 130 //Add image to dependency list of this image 131 void addDependency(Win32DllBase *dll); 132 BOOL dependsOn(Win32DllBase *dll); 130 133 131 134 protected: 132 void tlsAlloc();//Allocate TLS index for this module133 void tlsDelete();//Destroy TLS index for this module135 void tlsAlloc(); //Allocate TLS index for this module 136 void tlsDelete(); //Destroy TLS index for this module 134 137 135 ULONG errorState, entryPoint; 138 ULONG errorState, 139 entryPoint; 136 140 137 char *fullpath;138 charszModule[CCHMAXPATH];139 charszFileName[CCHMAXPATH];141 char * fullpath; 142 char szModule[CCHMAXPATH]; 143 char szFileName[CCHMAXPATH]; 140 144 141 HINSTANCEhinstance;145 HINSTANCE hinstance; 142 146 143 LPVOID tlsAddress;//address of TLS data144 LPDWORD tlsIndexAddr;//address of DWORD that receives the TLS index145 ULONG tlsInitSize;//size of initialized TLS memory block146 ULONG tlsTotalSize;//size of TLS memory block147 PIMAGE_TLS_CALLBACK *tlsCallBackAddr;//ptr to TLS callback array148 ULONG tlsIndex;//module TLS index147 LPVOID tlsAddress; //address of TLS data 148 LPDWORD tlsIndexAddr; //address of DWORD that receives the TLS index 149 ULONG tlsInitSize; //size of initialized TLS memory block 150 ULONG tlsTotalSize; //size of TLS memory block 151 PIMAGE_TLS_CALLBACK * tlsCallBackAddr; //ptr to TLS callback array 152 ULONG tlsIndex; //module TLS index 149 153 150 151 154 PIMAGE_RESOURCE_DIRECTORY getResSubDirW(PIMAGE_RESOURCE_DIRECTORY pResDir, LPCWSTR lpszName); 155 PIMAGE_RESOURCE_DIRECTORY getResSubDirA(PIMAGE_RESOURCE_DIRECTORY pResDir, LPCTSTR lpszName); 152 156 153 157 PIMAGE_RESOURCE_DATA_ENTRY getResDataLang(PIMAGE_RESOURCE_DIRECTORY pResDir, ULONG language, BOOL fGetDefault = FALSE); 154 158 155 156 157 159 HRSRC getResourceLang(PIMAGE_RESOURCE_DIRECTORY pResDirToSearch); 160 HRSRC getResourceLangEx(PIMAGE_RESOURCE_DIRECTORY pResDirToSearch, 161 DWORD lang); 158 162 159 PIMAGE_RESOURCE_DIRECTORYpResRootDir;163 PIMAGE_RESOURCE_DIRECTORY pResRootDir; 160 164 161 162 ULONGulRVAResourceSection;165 //substracted from RVA data offsets 166 ULONG ulRVAResourceSection; 163 167 164 //linked list of dlls loaded on behalf of this executable image (dll or exe) 165 Queue loadedDlls; 168 //linked list of dlls loaded on behalf of this executable image (dll or exe) 169 Queue loadedDlls; 170 166 171 private: 167 168 friend class Win32Resource; 169 friend ULONG SYSTEM GetVersionSize(char *modname); 172 friend class Win32Resource; 173 friend ULONG SYSTEM GetVersionSize(char *modname); 170 174 }; 171 175 … … 180 184 } WINIMAGE_LOOKUP; 181 185 182 #define WINIMAGE_LOOKUPADDR(a) 186 #define WINIMAGE_LOOKUPADDR(a) (WINIMAGE_LOOKUP *)((ULONG)a + PAGE_SIZE - sizeof(WINIMAGE_LOOKUP)) 183 187 184 188 #endif //__WINIMAGEBASE_H__
Note:
See TracChangeset
for help on using the changeset viewer.