View previous topic :: View next topic |
Author |
Message |
mr.moon Newbie cheater
Reputation: 0
Joined: 27 Aug 2016 Posts: 12
|
Posted: Sun Aug 28, 2016 6:36 pm Post subject: c++ a weird problem |
|
|
hello the problem is if copy the project after build to other place it don't work if it in normal path it work that mean Debug & Release where it build it work other path it don't |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Aug 28, 2016 10:33 pm Post subject: |
|
|
Does your project use specific paths or files that are not being adjusted / moved when you copy the project to another folder? _________________
- Retired. |
|
Back to top |
|
 |
mr.moon Newbie cheater
Reputation: 0
Joined: 27 Aug 2016 Posts: 12
|
Posted: Sun Aug 28, 2016 10:38 pm Post subject: |
|
|
atom0s wrote: | Does your project use specific paths or files that are not being adjusted / moved when you copy the project to another folder? |
no |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Aug 28, 2016 10:58 pm Post subject: |
|
|
Outside of that, unless you post code there is not much anyone can do to help you as we have no idea what your project is doing etc. _________________
- Retired. |
|
Back to top |
|
 |
mr.moon Newbie cheater
Reputation: 0
Joined: 27 Aug 2016 Posts: 12
|
Posted: Mon Aug 29, 2016 5:25 pm Post subject: |
|
|
atom0s wrote: | Outside of that, unless you post code there is not much anyone can do to help you as we have no idea what your project is doing etc. |
because the source is huge can't anyway fixed it was a windows problem maybe |
|
Back to top |
|
 |
kuntz Cheater
Reputation: 0
Joined: 29 Aug 2016 Posts: 44 Location: Canada
|
Posted: Tue Aug 30, 2016 4:47 pm Post subject: |
|
|
It sounds like somewhere in the program it is using the current 'Working Directory' for something. Can you tell us what the program is supposed to do?
There are a few simple tricks you can do to make the program "location agnostic", which means the program will run the same irregardless of where it is run from.
Code: | void set_working_directory(void)
{
// Set the current directory to where the EXE is located
char buf1[512], buf2[512], *p;
GetModuleFileName(0, buf1, 512);
GetFullPathName(buf1, 512, buf2, &p);
*p = 0;
SetCurrentDirectory(buf2);
} |
This code will set the Working Directory to the same directory the EXE is located in. Windows does not always set the Working Directory to the EXE location, there are instances where it is set to some other location. This can be helpful for DLL injection where the location of the EXE loader and DLL file may not be the same directory as the running target (game). So the DLL is loaded into a process that has a different directory than where the DLL is located, so if the DLL tries to load some support/setting files, it wont find them.
microsoft-com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx |
|
Back to top |
|
 |
|