How to obtain the Module/Process Name of the application within?
Basically i am trying to simulate - GetModuleFileNa meW
Trying this: (which doesnt work)
ProcessModule procModule = new ProcessModule() ; //Gives an error
here without hinting on the right syntax
string szModulePath = procModule.File Name.ToString() ;
What is the right way of getting this working in .NET???
I even tried using GetModuleFileNa meW by using [DllImport("Kern el32.dll")]
but could not marshal the second parameter right.
[DllImport("Kern el32.dll")]
public static extern IntPtr GetModuleFileNa meW(
IntPtr hModule,
[MarshalAs(Unman agedType.SafeAr ray)]
String[] lpFilename,
Int32 nSize
);
When I make a call could only obtain value 'C' in szModulePath instead of
'C:\\xxx\xx\x.x "
string[] szModulePath = {};
int iRetVal = (int)GetModuleF ileNameW(OwnerH andle,szModuleP ath,MAXI_PATH);
- Arc
Basically i am trying to simulate - GetModuleFileNa meW
Trying this: (which doesnt work)
ProcessModule procModule = new ProcessModule() ; //Gives an error
here without hinting on the right syntax
string szModulePath = procModule.File Name.ToString() ;
What is the right way of getting this working in .NET???
I even tried using GetModuleFileNa meW by using [DllImport("Kern el32.dll")]
but could not marshal the second parameter right.
[DllImport("Kern el32.dll")]
public static extern IntPtr GetModuleFileNa meW(
IntPtr hModule,
[MarshalAs(Unman agedType.SafeAr ray)]
String[] lpFilename,
Int32 nSize
);
When I make a call could only obtain value 'C' in szModulePath instead of
'C:\\xxx\xx\x.x "
string[] szModulePath = {};
int iRetVal = (int)GetModuleF ileNameW(OwnerH andle,szModuleP ath,MAXI_PATH);
- Arc
Comment