Originally Posted by
novacain
Where does the resource come from? (a DLL or the exe)
Resource comes from the exe.
Have you tried NULL as the hModule?
Yea that's what I'm using. Check the code at the bottom of this post.
Why would it become invalid?
What does GetLastError() return?
1812: ERROR_RESOURCE_DATA_NOT_FOUND :/
code:
Code:
char shortpath[MAX_PATH] = {""},longpath[MAX_PATH] = {""};
HMODULE modhandle;
modhandle = GetModuleHandle(NULL);
GetModuleFileName(modhandle,longpath,MAX_PATH);
GetShortPathName(longpath,shortpath,MAX_PATH);
HMODULE hLibrary;
HRSRC hResource;
HGLOBAL hResourceLoaded;
LPBYTE lpBuffer;
hLibrary = LoadLibrary(shortpath);
if (hLibrary == NULL){
printf("Error loading hlibrary\n");
return -1;
}
printf("longpath: %s\n", longpath);
printf("shortpath: %s\n", shortpath);
if(IS_INTRESOURCE(101) == FALSE){
printf("101 is not a resource identifier...\n");
return -1;
}
hResource = FindResource(hLibrary, MAKEINTRESOURCE(101), RT_RCDATA);
if(hResource == NULL){
printf("%d\n", GetLastError());
printf("Error finding resource\n");
return -1;
}
Thanks for the help, thus far.