|
You're welcome.
|
|
|
|
|
Hi
I am trying to get list of import module names from PE file. But i can not find the solution.
This is my code:
CString CPE::GetImportModuleNames(CString str_SectionHdrName)<br />
{<br />
CString c;<br />
<br />
<br />
IMAGE_DOS_HEADER * dosheader=(IMAGE_DOS_HEADER *)g_pMappedFileBase;<br />
IMAGE_OPTIONAL_HEADER * opthdr =(IMAGE_OPTIONAL_HEADER *) <br />
((BYTE*)dosheader+dosheader->e_lfanew+24);<br />
<br />
IMAGE_IMPORT_DESCRIPTOR * descriptor=(IMAGE_IMPORT_DESCRIPTOR *)<br />
((BYTE*)dosheader+ <br />
opthdr->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);<br />
<br />
<br />
return c;<br />
}
In Documentation, it says:
" The IMAGE_IMPORT_DESCRIPTOR struct consists of five fields :
Union {
DWORD Characteristics;
PIMAGE_THUNK_DATA OriginalFirstThunk;
};
DWORD TimeDateStamp;
DWORD ForwarderChain;
DWORD Name;
PIMAGE_THUNK_DATA FirstThunk;"
...
"Name contains the a pointer (RVA) to the ASCII name of the DLL."
How can i retrieve the name of modules from that pointer(RVA).
Now i think i must write a loop and get the names but i couldn't do the the last step.
while(?)
{
descriptor->Name (?)
}
Could you please help me.
Thank you.
|
|
|
|
|
Hi serimcc,
serimcc wrote: I am trying to get list of import module names from PE file. But i can not find the solution.
Pietrek has placed his code for examining PE files on the web. The articles of interest are:
* An In-Depth Look into the Win32 Portable Executable File Format, Part 1
* An In-Depth Look into the Win32 Portable Executable File Format, Part 2
* What Goes On Inside Windows 2000: Solving the Mysteries of the Loader
I used them as a basis for a couple of article I wrote a while back...
Jeff
|
|
|
|
|
Thank you
I knew these articles. But i couldn't find the solution from Pietrek's articles.
I need only last step.
|
|
|
|
|
Im not sure see this[^] article is helpful for you.
|
|
|
|
|
Hi All,
Does anyone recall a good artilce on Reading and Writing Raw Sectors under the NT family?
Jeff
|
|
|
|
|
|
Hello,
I have a buffer that contains words. However, the words comes from a client. I just want to get the words out. However, the buffer is being filled with rubbish after the words. Example "Manchester United&^&*#&#&##^&#@*&^^ etc.
How can I just get "Manchester United" out?
I have used the following using length and substring, but it displays everything
<br />
char buffer[256]; <br />
sock.receiveFrom(buffer,sizeof(buffer), addr);<br />
std::string message = buffer;<br />
int strLength = 0;<br />
strLength = message.size();<br />
std::cout << "The length of the string is: " << strLength << std::endl;<br />
message = message.substr(0,strLength);<br />
std::cout << message;<br />
Many thanks,
Steve
|
|
|
|
|
|
ensure the buffer is properly initialized to all zeros and make sure to tell the sock.receiveFrom to not overwrite what could be the last null terminator
char buffer[256] = { 0 }; <br />
sock.receiveFrom(buffer,sizeof(buffer)-1, addr);<br />
or
char buffer[256]; <br />
ZeroMemory(buffer,sizeof(buffer));<br />
sock.receiveFrom(buffer,sizeof(buffer)-1, addr);<br />
|
|
|
|
|
Thanks,
That worked great,
Steve
|
|
|
|
|
But what happens if you then receive a shorter string of characters from the socket? Parts of "Manchester United" will still be intact. While calling ZeroMemory() may to work, a better solution was suggested by chandu004.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
what roger has suggested is good.
but i think, your receive function should return, the number of bytes actually read.
so based on that number, you can cut your string to that many number of bytes.
im not sure but just try it out.
|
|
|
|
|
chandu004 wrote: so based on that number, you can cut your string to that many number of bytes.
And then NULL terminate...
Jeff
|
|
|
|
|
|
chandu004 wrote: yah obviously.
Perhaps not...
|
|
|
|
|
Hi Friends
In my program there are too many child windows arraged horizontally. How can change size of each sub windows
thanks in advance
-RisKhan-
|
|
|
|
|
|
|
RisKhan wrote: In my program there are too many child windows arraged horizontally.
So can't you just rearrange them via the resource editor?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'm not entirely sure I see your problem. If it is your program, don't put too many in a row in the first place.
Either by using the resource editor as David suggested, or putting something in the Y parameter of CreateWindow when you call that.
If these windows can move depending on other conditions, and there are a lot of them, then you should look at the DeferWindowPos family of functions.
Iain.
|
|
|
|
|
Hi all,
I want to implement a timer in my simple sdi applcation. How to do it?
Thanks in advance
|
|
|
|
|
neha.agarwal27 wrote:
I want to implement a timer in my simple sdi applcation. How to do it?
See Here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
You can use of WM_TIMER and SetTimer.
|
|
|
|
|
my systems all c++ .h files showing 0 bytes can i write any programme to recover my data back
RajeshGupta
|
|
|
|