Re: registry code sample
- From: "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
- Date: Sun, 25 Jan 2009 13:45:27 -0500
You don't seem to understand pointers. For Example:
LPSECURITY_ATTRIBUTES sa;
sa->nLength=sizeof(SECURITY_ATTRIBUTES);//0
sa->lpSecurityDescriptor=NULL;
sa->bInheritHandle=TRUE;//true
LPDWORD disp;
if(RegCreateKeyEx(ihkey[0],subkey,0,NULL,options,rsam,sa,iphkey[1],disp)!=ERROR_SUCCESS)_er=1;
Both sa and disp are uninitialized pointers. They will cause immediate access violations or worse.
sa contains garbage. Then you immediately attempt to reference a member of it.
disp contains garbage. Then you immediately pass it to RegCreateKeyEx.
A hint: Never declare an 'LP' variable. Instead declar the actual object:
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
To pass this to RegCreateKeyEx use &sa
Don't do any more C or C++ programming until you understand this issue !!
--
Scott McPhillips [VC++ MVP]
- Follow-Ups:
- Re: registry code sample
- From: Alec S.
- Re: registry code sample
- From: Starglider 4 \(Marco Knoester\)
- Re: registry code sample
- References:
- registry code sample
- From: Starglider 4 \(Marco Knoester\)
- Re: registry code sample
- From: Norman Bullen
- Re: registry code sample
- From: Starglider 4 \(Marco Knoester\)
- registry code sample
- Prev by Date: Re: IDC_STATIC definition missing in resource.h
- Next by Date: Re: registry code sample
- Previous by thread: Re: registry code sample
- Next by thread: Re: registry code sample
- Index(es):