- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a dll that contains the following code:
use dfwin
Character(256) path,path1
integer(4) pathln
pathln = GetModuleFileName (NULL, path1, pathln)
I am using Intel Fortran 9.0
On one computer, the call is fine. We find the path & pathlength. On 2 other development machines we get nothing. I am told that originally the path was indeed returned.
Does anyone have any ideas of what I should/could look for that would cause the API to return nothing. Note: it does not give any sort of errors and such, it simply returns and empty string & a 0 for the length.
Having asked the all important question "What changedd?" did not help. Also of note, I replaced the non functioning code with the funtioning (project files and all, literally everything that is contained in the parent folder) and still the API doesn't return an answer.
HELP!
use dfwin
Character(256) path,path1
integer(4) pathln
pathln = GetModuleFileName (NULL, path1, pathln)
I am using Intel Fortran 9.0
On one computer, the call is fine. We find the path & pathlength. On 2 other development machines we get nothing. I am told that originally the path was indeed returned.
Does anyone have any ideas of what I should/could look for that would cause the API to return nothing. Note: it does not give any sort of errors and such, it simply returns and empty string & a 0 for the length.
Having asked the all important question "What changedd?" did not help. Also of note, I replaced the non functioning code with the funtioning (project files and all, literally everything that is contained in the parent folder) and still the API doesn't return an answer.
HELP!
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What does a subsequent GetLastError call return?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the value of pathln passed into GetModuleFileName?
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
... that argument should be simply LEN(path1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GetLastError returns a 6.
Although I have decared pathln, I have not set it's value at the time the call is made.
Although I have decared pathln, I have not set it's value at the time the call is made.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ahh, theres the rub JugoslavDujic, I actually am more interested in the path itself (hence the API call). I am indeed using the value of the length but it is the path that I am in search of.
Thanks
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jugoslav is correct - the third argument is an input that is the size of the path buffer argument. It is not an output parameter. Since you're passing an uninitialized variable, the API routine may or may not decide that the buffer overflows.
If you want the length of the returned path you look at the function result.
If you want the length of the returned path you look at the function result.
Message Edited by Steve_Lionel on 04-18-2006 12:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Beautiful -- thanks Jugoslav & Steve, I misunderstood what you meant but you are correct, as soon as I changed that 3rd argument, it works.
I appreciate the help.
:)
I appreciate the help.
:)

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page