FindResource() / LoadResource() return an invalid pointer
- From: "chaim" <talkaboutcomputing.com-dz@xxxxxxxxxxxxxxxxx>
- Date: Mon, 12 Sep 2005 09:02:38 -0400
B"H
In
www.JewishContent.org/pda/pocket-pc/bavli/arm/bavli+rashi-Whole-Shas.exe -
which has 10,000+ RCDATA resources (starting from resource id 1001 through
11,999 - which is less than 0x7FFF) in the following routine:
char *GetRes(int res)
{
HRSRC hResource;
HGLOBAL glob;
int size;
char *txt;
if(!(hResource = FindResource(gInstance, res, RT_RCDATA)))
return 0;
if(!(size = SizeofResource(gInstance, hResource)) || !(glob =
LoadResource(gInstance, hResource)))
return 0;
txt = LockResource(glob);
return txt;
}
The pointer returned by FindResource() and/or LoadResource() seems to be
sporadic, when requesting a resource, sometimes the pointer is valid,
other times the pointer is invalid.
If I compile using DevStudio 5 - for Windows Desktop, under windows 2000
this error does not show up.
While debugging an "Windows Mobile 2003 SE" device I was able to see
sometimes this was an invalid pointer.
Furthermore, while debugging, I once got a valid pointer, but partially
through data (say SizeofResource() was 100, and at txt[73] was invalid
(while txt[72] was valid)! as it happened the address where the pointer
became invalid was at memory location 0x3360:0000 - which seems to point
at "page fault" or similar which Windows CE is not handling properly
within resource DATA.
- Chaim
.
- Prev by Date: Re: 16/24 bits BitBlt Performance
- Next by Date: Re: VS.NET 2K5 and Visual Inheritance?
- Previous by thread: RTS_CONTROL_TOGGLE does not work
- Next by thread: DeviceMap/TOUCH calibration doesn't work on Intermec 761?
- Index(es):
Relevant Pages
|
Loading