Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » pointer to exe in memory?
pointer to exe in memory? [message #22535] Fri, 24 July 2009 21:44 Go to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Hi,

Is there a way to get hold of a pointer to the beginning of the memory containing the executable? I want this so I can put together a scheme which can verify the authenticity of the executable being used.

Failing that, is there a way to find where the current executable was read from (on disk).

I realise these are strange requests but I'm trying to come up with something that is secure but doesn't harass users.

Nick
Re: pointer to exe in memory? [message #22537 is a reply to message #22535] Sat, 25 July 2009 00:19 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3248
Registered: August 2008
Senior Veteran
Hello nixnixnix

If you want to get the file address in Windows perhaps you can use CreateFile to get a file handler and SetFilePointerEx to get the address of the beginning of the file.

Best regards
Koldo


Best regards
Iñaki
Re: pointer to exe in memory? [message #22542 is a reply to message #22535] Sun, 26 July 2009 03:38 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13033
Registered: November 2005
Ultimate Member
In Win32, these might be useful:

http://msdn.microsoft.com/en-us/library/ms683200(VS.85).aspx
Re: pointer to exe in memory? [message #22575 is a reply to message #22542] Tue, 28 July 2009 01:05 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Thanks.

I'll give this a try although this reads the prgram from disk right? Not from what is in memory? ( I realise that unless this function gets compromised its the same thing).

Nick
Re: pointer to exe in memory? [message #22578 is a reply to message #22575] Tue, 28 July 2009 08:12 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3248
Registered: August 2008
Senior Veteran
Hello nixnixnix

SetFilePointerE is supposed to get the file position and Mirek's post (
http://msdn.microsoft.com/en-us/library/ms683200) is to get the program position in memory.

Best regards
Koldo


Best regards
Iñaki
Re: pointer to exe in memory? [message #22681 is a reply to message #22578] Wed, 05 August 2009 00:51 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Thanks Koldo but I don't appear to have SetFilePointerEx in my version of UPP (latest from SVN). Am I missing something?
Re: pointer to exe in memory? [message #22686 is a reply to message #22681] Wed, 05 August 2009 08:35 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3248
Registered: August 2008
Senior Veteran
Oh Nixnixnix, it is not so easy.

You can find a reference in http://msdn.microsoft.com/en-us/library/aa365542%28VS.85%29. aspx and in http://msdn.microsoft.com/en-us/library/cc500401.aspx there is a general explanation.

SetFilePointerEx gives a file pointer, although I do not know if it will serve you.

Best regards
Koldo


Best regards
Iñaki
Re: pointer to exe in memory? [message #22743 is a reply to message #22686] Mon, 10 August 2009 20:44 Go to previous message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Hey Koldo,

Thanks for your help. I found

GetExeFilePath()

so am using that for now.

Thanks again,

Nick
Previous Topic: Someone have examples for Geom Package ?
Next Topic: Using openssl functions on U++
Goto Forum:
  


Current Time: Tue Jan 19 03:21:28 CET 2021

Total time taken to generate the page: 0.01525 seconds