Click here to Skip to main content
15,917,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Webcam Pin
geo_m16-Sep-04 5:24
geo_m16-Sep-04 5:24 
Generalwav file resampling Pin
sinha_abhijeet16-Sep-04 0:52
sinha_abhijeet16-Sep-04 0:52 
GeneralRe: wav file resampling Pin
Alexander M.,16-Sep-04 9:49
Alexander M.,16-Sep-04 9:49 
GeneralGetting IPv6 address Pin
Alpha Siera16-Sep-04 0:47
Alpha Siera16-Sep-04 0:47 
GeneralRe: Getting IPv6 address [modified] Pin
Antony M Kancidrowski16-Sep-04 2:31
Antony M Kancidrowski16-Sep-04 2:31 
GeneralRe: Getting IPv6 address [modified] Pin
Alpha Siera16-Sep-04 18:27
Alpha Siera16-Sep-04 18:27 
Generalfile Pin
swarup16-Sep-04 0:46
swarup16-Sep-04 0:46 
GeneralRe: file Pin
Paolo Ponzano16-Sep-04 2:23
Paolo Ponzano16-Sep-04 2:23 
I think you use the GetOpenFileName() to open the exe file
the you need an handle in order to open file using CreateFileA

<br />
HANDLE hFile=CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);<br />


at this point you should have an handle to your exe file, now we read it into memory using ReadFileA

<br />
DWORD BR=0; //numbers of bytes read by readfile<br />
char *tempbuff=(char*)calloc(dFileSize,sizeof(char));<br />
<br />
ReadFile(hFile, tempbuff, dFileSize, &BR, NULL);<br />
<br />
if( BR < dFileSize){<br />
//Process the error, since not all file could have been read<br />
}<br />


now we search the string you're looking for

<br />
char *p=NULL;<br />
p=strstr(tempbuff,"TEXT_TO_BE_SEARCHED");<br />
if( p==NULL) // no TEXT_TO_BE_SEARCHED found in tempbuff<br />
else you've the first occurrence<br />


for writing you do the same using WriteFile,
bye
Paolo
GeneralRe: file Pin
swarup18-Sep-04 2:06
swarup18-Sep-04 2:06 
GeneralWindows .libs Pin
JensB16-Sep-04 0:27
JensB16-Sep-04 0:27 
GeneralRe: Windows .libs Pin
geo_m16-Sep-04 5:20
geo_m16-Sep-04 5:20 
GeneralDLL Pin
swarup16-Sep-04 0:03
swarup16-Sep-04 0:03 
GeneralRe: DLL Pin
Paolo Ponzano16-Sep-04 2:31
Paolo Ponzano16-Sep-04 2:31 
GeneralThread Pin
swarup16-Sep-04 0:00
swarup16-Sep-04 0:00 
GeneralRe: Thread Pin
RChin16-Sep-04 0:23
RChin16-Sep-04 0:23 
GeneralDisable Restart from the windows shutdown dialog box Pin
sirtimid15-Sep-04 23:14
sirtimid15-Sep-04 23:14 
GeneralDisable Restart from the windows shutdown dialog box Pin
sirtimid15-Sep-04 23:13
sirtimid15-Sep-04 23:13 
GeneralDeleting ODBC Datasources Pin
si_6915-Sep-04 23:00
si_6915-Sep-04 23:00 
GeneralRe: Deleting ODBC Datasources Pin
P-Rex15-Sep-04 23:55
P-Rex15-Sep-04 23:55 
GeneralRe: Deleting ODBC Datasources Pin
P-Rex16-Sep-04 0:01
P-Rex16-Sep-04 0:01 
GeneralAsynch Serial Comms - IO Completion Pin
louis15-Sep-04 22:40
louis15-Sep-04 22:40 
GeneralVisual C++ (MFC) : Using Matrix to set an part of an image to zero Pin
pohcb_sonic15-Sep-04 21:50
pohcb_sonic15-Sep-04 21:50 
GeneralRe: Visual C++ (MFC) : Using Matrix to set an part of an image to zero Pin
V.15-Sep-04 22:15
professionalV.15-Sep-04 22:15 
GeneralRe: Visual C++ (MFC) : Using Matrix to set an part of an image to zero Pin
pohcb_sonic16-Sep-04 15:21
pohcb_sonic16-Sep-04 15:21 
GeneralRe: Visual C++ (MFC) : Using Matrix to set an part of an image to zero Pin
V.16-Sep-04 20:39
professionalV.16-Sep-04 20:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.