MCPcopy Create free account
hub / github.com/Schnocker/NoEye / LoadFileFromResourcesW

Function LoadFileFromResourcesW

NoEye_Service/CMap.cpp:148–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146 return Result;
147 }
148 BOOL LoadFileFromResourcesW(HANDLE hProcess, LPCWSTR lpName, LPCWSTR ResourceType, DWORD Flags, WDLL*& wFile)
149 {
150
151 HRSRC hResource = 0;
152 DWORD ResourceLen = 0, FileSize = 0;
153 BOOL Status = 0;
154 PIMAGE_SECTION_HEADER SectionHeaders = 0;
155 if (!wFile)
156 {
157 SetLastError(1890);
158 return 0;
159 }
160 hResource = FindResourceW(NULL, lpName, ResourceType);
161 if (!hResource)
162 {
163 SetLastError(1891);
164 return 0;
165 }
166 FileSize = SizeofResource(NULL, hResource);
167 wFile->Module = reinterpret_cast<HMODULE>(LoadResource(0, hResource));
168
169 if (!FileSize || !wFile->Module || !LockResource(wFile->Module))
170 {
171 SetLastError(1892);
172
173 return 0;
174 }
175 wFile->hProcess = hProcess;
176 wFile->Flags = Flags;
177 Status = LoadFileFromMemory(wFile->hProcess, wFile->Module, wFile->Flags, wFile);
178 if (wFile->Module)
179 FreeResource(reinterpret_cast<HGLOBAL>(wFile->Module));
180 wFile->Module = 0;
181
182 return Status;
183 }
184
185
186 BOOL LoadFileFromMemory(HANDLE hProcess, LPVOID lpDll, DWORD Flags, WDLL*& wFile)

Callers 1

LoadFileFromResourcesAFunction · 0.85

Calls 1

LoadFileFromMemoryFunction · 0.85

Tested by

no test coverage detected