Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] getting Windows Dir...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sun Aug 10, 2008 11:41 am    Post subject: [C++] getting Windows Dir... Reply with quote

i was wondering ..
how can i get my WINDOWS Folder's Direction through C++
and store it inside a variable ?

_________________
Stylo
Back to top
View user's profile Send private message
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Sun Aug 10, 2008 11:44 am    Post subject: Reply with quote

I'm sure registry is perfect for this.
Open regedit, and look around for the path.
And after you've got the name for the registry key, get it into C++ using the registry functions.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sun Aug 10, 2008 11:48 am    Post subject: Reply with quote

is it the only way to get windows direction ? :\
aren't there easier ways?
anyway thx.. i'll try to figure out where the path is stored inside the regedit

_________________
Stylo
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Aug 10, 2008 11:52 am    Post subject: Reply with quote

Lol. There are APIs for this. I included this option in my program COMPINFO. Here's the snippet.

Code:

LPSTR *lpBuffer = new LPSTR;
GetWindowsDirectory((LPSTR)lpBuffer, MAX_PATH);
cout<<"Windows Directory: "<<(LPSTR)lpBuffer<<"\n";
delete lpBuffer;

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Sun Aug 10, 2008 11:54 am    Post subject: Reply with quote

oib111 wrote:
Lol. There are APIs for this. I included this option in my program COMPINFO. Here's the snippet.

Code:

LPSTR *lpBuffer = new LPSTR;
GetWindowsDirectory((LPSTR)lpBuffer, MAX_PATH);
cout<<"Windows Directory: "<<(LPSTR)lpBuffer<<"\n";
delete lpBuffer;

Ah, I forgot that one.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sun Aug 10, 2008 12:05 pm    Post subject: Reply with quote

i thought it's strange
must be easier way to get the windows path...
thx oib111 :] and Moller too

_________________
Stylo
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Aug 10, 2008 12:35 pm    Post subject: Reply with quote

Code:
TCHAR tszWindowsDirectory[ MAX_PATH ] = {0};
GetWindowsDirectory( tszWindowsDirectory, MAX_PATH );


No need to use 'new'.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Aug 10, 2008 2:11 pm    Post subject: Reply with quote

I know. But I was using dynamic memory in my program (so that if you did that option like 5 times, you wouldn't have five variables declared in memory).
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sun Aug 10, 2008 3:30 pm    Post subject: Reply with quote

oib111 wrote:
I know. But I was using dynamic memory in my program (so that if you did that option like 5 times, you wouldn't have five variables declared in memory).


Just use one big variable to use everything for. ._.

You were only accessing one at a time, right?

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites