Finding the path of the Windows VM executable?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Finding the path of the Windows VM executable?

Martin McClure-3
Hi all,

What's the easiest way, from within Windows VW, of determining the full
path to the directory in which the VM resides?

Thanks,

-Martin
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Finding the path of the Windows VM executable?

Boris Popov, DeepCove Labs (SNN)
GetModuleFileName(NULL,lpFilename,nSize)

http://msdn.microsoft.com/en-us/library/windows/desktop/ms683197(v=vs.85
).aspx

HTH,

-Boris

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Martin McClure
Sent: Wednesday, April 18, 2012 1:44 PM
To: vwnc
Subject: [vwnc] Finding the path of the Windows VM executable?

Hi all,

What's the easiest way, from within Windows VW, of determining the full
path to the directory in which the VM resides?

Thanks,

-Martin
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Finding the path of the Windows VM executable?

Holger Guhl
In reply to this post by Martin McClure-3
CEnvironment commandLine first asFilename directory

Am 18.04.2012 19:44, schrieb Martin McClure:

> Hi all,
>
> What's the easiest way, from within Windows VW, of determining the full
> path to the directory in which the VM resides?
>
> Thanks,
>
> -Martin
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Finding the path of the Windows VM executable?

Terry Raymond
Sorry Holger, but this does not always work. If the exe is in the system
path variable
then it does not show up on the command line. GetModuleFileName is the only
way I
found that will reliably return the correct file path.

Terry

===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
===========================================================

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Holger Guhl
> Sent: Wednesday, April 18, 2012 2:18 PM
> To: Martin McClure
> Cc: vwnc
> Subject: Re: [vwnc] Finding the path of the Windows VM executable?
>
> CEnvironment commandLine first asFilename directory
>
> Am 18.04.2012 19:44, schrieb Martin McClure:
> > Hi all,
> >
> > What's the easiest way, from within Windows VW, of determining the
> > full path to the directory in which the VM resides?
> >
> > Thanks,
> >
> > -Martin
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Finding the path of the Windows VM executable?

Holger Guhl
Oops! Thanks a lot for this one. I am always eager to learn. Although I made a couple of runtimes, I
never came to the point to have the exe in the PATH. I wondered why Boris' answer was so special.

Cheers,
Holger

Am 18.04.2012 21:33, schrieb Terry Raymond:

> Sorry Holger, but this does not always work. If the exe is in the system
> path variable
> then it does not show up on the command line. GetModuleFileName is the only
> way I
> found that will reliably return the correct file path.
>
> Terry
>
> ===========================================================
> Terry Raymond
> Crafted Smalltalk
> 80 Lazywood Ln.
> Tiverton, RI  02878
> (401) 624-4517      [hidden email]
> ===========================================================
>
>> -----Original Message-----
>> From: [hidden email] [mailto:[hidden email]] On
>> Behalf Of Holger Guhl
>> Sent: Wednesday, April 18, 2012 2:18 PM
>> To: Martin McClure
>> Cc: vwnc
>> Subject: Re: [vwnc] Finding the path of the Windows VM executable?
>>
>> CEnvironment commandLine first asFilename directory
>>
>> Am 18.04.2012 19:44, schrieb Martin McClure:
>>> Hi all,
>>>
>>> What's the easiest way, from within Windows VW, of determining the
>>> full path to the directory in which the VM resides?
>>>
>>> Thanks,
>>>
>>> -Martin
>>> _______________________________________________
>>> vwnc mailing list
>>> [hidden email]
>>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>> _______________________________________________
>> vwnc mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Finding the path of the Windows VM executable?

Mark Pirogovsky-3
In reply to this post by Boris Popov, DeepCove Labs (SNN)
Make sure that you use the "wide" version of it, otherwise it fails on
the non ASCII path:


here is what I use:

getModuleFileName: aHandle
     "The GetModuleFileName function retrieves the fully-qualified path
for the file that contains the specified module that the current process
owns.
The handle Handle to the module whose path is being requested. If this
parameter is NULL, GetModuleFileName retrieves the path of the
executable file of the current process"

     | xif shortPath resultLength longName |
     ^
     [xif := self new.
     shortPath := xif LPCWSTR gcMalloc: 2 ** 15 - 1.
     resultLength := xif
                 GetModuleFileNameW: aHandle
                 into: shortPath
                 inBufferSized: 2 ** 15 - 1.
     longName := shortPath copyUnicodeStringFromHeap.
     resultLength = 0 ifTrue: [nil] ifFalse: [longName]]
             on: Error
             do: [:ex | ex returnWith: nil]


GetModuleFileNameW: hModule into: lpFilename inBufferSized: nSize
<C: DWORD _wincall GetModuleFileNameW(
           HMODULE hModule,
          LPCWSTR lpFilename,
           DWORD nSize)>
     ^self externalAccessFailedWith: _errorCode


Boris Popov, DeepCove Labs wrote:

> GetModuleFileName(NULL,lpFilename,nSize)
>
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms683197(v=vs.85
> ).aspx
>
> HTH,
>
> -Boris
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Martin McClure
> Sent: Wednesday, April 18, 2012 1:44 PM
> To: vwnc
> Subject: [vwnc] Finding the path of the Windows VM executable?
>
> Hi all,
>
> What's the easiest way, from within Windows VW, of determining the full
> path to the directory in which the VM resides?
>
> Thanks,
>
> -Martin
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Finding the path of the Windows VM executable?

Steve Cline
Mark, would you mind posting a couple of example calls and the expected results?  If I want the path of the current executable, is the argument nil or the string 'NULL'?
Reply | Threaded
Open this post in threaded view
|

Re: Finding the path of the Windows VM executable?

Steve Cline
to answer my own question, the argument is nil