Announcement
Collapse
No announcement yet.
YASU 1.4 can't find DT
Collapse
X
-
Try
Code:> cd "C:\Program Files\DAEMON Tools\" > YASU.exe -s
-
Originally Posted by Mikado View PostI'm not stupid and understand that YASU looks for DT in current dir, and all i need is to write .bat and pu it in startup. But this is still a bug, and i'm reporting it
Entering the complete path in the command line does not change the directory at all. The program runs FROM the directory you entered, but not IN the directory. The system stays in the directory the command line is in.
So it's not a bug.
Sure, the programmer of Yasu could look for DT/DTPro in the registry and change the directory by the program itself, but I think the programmer had good reasons to make it that way.Last edited by DomiOh; 27.08.2007, 15:41.
Comment
-
I insist it IS a bug, since YASU creates non-working startup key ITSELF.
Second, any win32 program can simply figure its location by examining arguments string, args[0] will be "C:\Program Files\DAEMON Tools\YASU.exe" and args[1] will be "-s". YASU checks args[1] but ignores args[0].
Comment
-
Originally Posted by DomiOh View PostSure, the programmer of Yasu could look for DT/DTPro in the registry and change the directory by the program itself, but I think the programmer had good reasons to make it that way.
Comment
-
Originally Posted by Mikado View PostI insist it IS a bug, since YASU creates non-working startup key ITSELF.
Second, any win32 program can simply figure its location by examining arguments string, args[0] will be "C:\Program Files\DAEMON Tools\YASU.exe" and args[1] will be "-s". YASU checks args[1] but ignores args[0].
Win32 Native programs don't use old style
int main(int argc, char *argv)
entry code, but
int WINAPI WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd )
You must extract the path from lpCmdLine by yourself.
Additionally it is not wanted by MS to change the current working directory by yourself. That is what for the "working folder" can be entered in the link options - if the program creates a link in start menu or on the desktop.
old
int _tmain(int argc, TCHAR *argv)
is only used by console applications... but since yasu doesn't start a console window when clicking on it's icon, it doesn't seem to be a console application.
It seems to be a native win32 application.
PS: Since Windows XP there is an API call for reading the command line, but it is Windows XP and higher only...
PPS: My code snippets are based on C++, don't know which language has been used to develop YASU.
Originally Posted by BenniNo, he couldn't. I discussed it with syk0 some weeks ago. DT has no permanent registry entries. Thats what speaks against that solution.Last edited by DomiOh; 27.08.2007, 18:42.
Comment
-
Originally Posted by DomiOh View Post...
int WINAPI WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd )
You must extract the path from lpCmdLine by yourself.
You can use __argv[x] and __argc, or for better handling of Unicode __targv[x].
@syk0
Why don't you use
DWORD GetModuleFileName(HMODULE hModule, LPTSTR lpFilename, DWORD nSize);
and
DWORD GetFullPathName(LPCTSTR lpFileName, DWORD nBufferLength, LPTSTR lpBuffer, LPTSTR* lpFilePart);
to get the path to your app?
If you have problems, PM me.
Comment
-
yup, GetModuleFileName is the best approach, then 'strip' the exe name from the data returned (strrchr for '\\').. delphi can most definately do this...
GetCurrentDirectory could also work, if the working directory is set (say from a shortcut), or if the exe has been run but hasn't changed directories (which yasu doesnt)...my views are 100% personal views..
Comment
Comment