Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get systemdir 1

Status
Not open for further replies.

iamDJ

Programmer
Nov 6, 2002
6
SE
Hi

I need some secure way of getting the system32 dir of windows.
It must be able to handle multiple windows installations on the same machine, and also support win98/winNT/win2000/winXP

Does anyone have any help for me?

Thanks
/Daniel
 
GetSystemDirectory is the API you're looking for....
Greetings,
Rick
 
OK
First i have to say that its been a while for me since i last did some vc.

I tried that API but got an error saying:

The instruction at "0x77f83e3e" referenced memory at "0xcccccccc". The memory could not be "written".

What do i have to declare?

Could someone please give me a hint or a simple sample?

Thanks!


/dj
 
For instance:

_TCHAR* pszPath = new _TCHAR[GetSystemDirectory(NULL, 0) + 1]; //Allocate buffer to hold system path.
GetSystemDirectory(pszPath, GetSystemDirectory(NULL, 0)+1)

Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top