|
Dear maciu2020,
I know your method of injection. I just want to learn my code why to crash.In addition, I have step up the privilege of process`s handle before the to call the function 'Inject'.
In you code, LoadLibraryA is a parameter of CreateRemoteThread. Given the address of LoadLibraryA is 0x7c801d77, the following code is ok.
<br />
HANDLE hRemoteThread = CreateRemoteThread(<br />
hTargetProcess, NULL, 0, 0x7c801d77,<br />
pRemotelyAllocatedStringContainigPathToTheDll, 0, &dwWriteBytes);<br />
Why it`s ok ??? There is only one reason which the address of LoadLibraryA is same in all process! In other words, LoadLibraryA==0x7c801d77 in process A and LoadLibraryA==0x7c801d77 in process B at the same time. Do you agree with my opinion ???
This is the key of my question, which, in my code, local calling LoadLibraryA is jmp/call 0x7c801d77 and the calling LoadLibraryA in remote thread proceduer is also jmp/call 0x7c801d77. Why the latter must crash?
|
|
|
|
|
Actually the address may vary, windows sets it while loading kernel32.dll.
But on each machine, all processes share kernel32.dll functions' addresses.
DWORD __stdcall RemoteThreadProc(LPVOID lParam)<br />
{<br />
__asm<br />
{<br />
push 0<br />
call DWORD PTR LoadLibrary<br />
}<br />
}
should be ok...as long as you compile your program with optimizations on.
It would be definitely OK if you wrote the whole thing in assembly to ensure that compiler won't insert there something you don't want it to.
push 0<br />
call DWORD PTR LoadLibrary<br />
retn 0
generates the same code, no matter where it's placed.
If it still doesn't work, can you disassembly RemoteThreadProc and post here?
|
|
|
|
|
deng0jun wrote: LoadLibraryA(NULL); //crash!!! Why crash???
Why would you expect it not to crash?
"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 guess, because LoadLibraryA checks if it's argument is 0. And to indicate this, he wrote that the same LoadLbraryA(NULL), when placed in own process, just fails, doesn't crash.
|
|
|
|
|
DavidCrow wrote: Why would you expect it not to crash?
Because calling 'LoadLibraryA(NULL);' is ok in local process.
|
|
|
|
|
But what does it do?
"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
|
|
|
|
|
Hello everybody.
I'm a MFC developer and I have a problem; i could not read a xml file in mfc (vs 6.0, c++). I don't know the differences reading a text file with reading a xml file, in mfc. Also; i don't know the xml open-read-write methods of the MFC (if there is??? ). How can I open and read xml files? Please help me.
Thanks in advance.
Sahan Askin
|
|
|
|
|
use tinyXML library in your project. it will ease your job
|
|
|
|
|
Thanks very much for your reply. I'm researching tinyxml now.
|
|
|
|
|
sahanaskin wrote: Thanks very much for your reply. I'm researching tinyxml now.
search cmarkup class in Codeproject, that it's another robust class available for XML handlling
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
|
Hi Friends,
In socket programming I want to connect double byte charcters.
Earlier we used recv() function for single byte charcter.
If we use double byte chracter in below recv function, its coming as a question mark symbol.
If anybody knows how can I handle double byte charcter in Scoket programing(recv function),Please let me know.
My codesnippet:
while( bytesRecv == SOCKET_ERROR ) {
bytesRecv = recv( ConnectSocket, recvbuf, 64, 0 );
if ( bytesRecv == 0 || bytesRecv == WSAECONNRESET || CheckTimeOut()) {
return CloseListen();
}
}
Note:Here recvbuf works for singel byte not for doublebyte charcters.
Thanks in advance.
|
|
|
|
|
Raghavendra Pise wrote: Note:Here recvbuf works for singel byte not for doublebyte charcters.
You need to do some studying on character encoding, thinks like Unicode etc. Here is just one example[^]
|
|
|
|
|
In addition to led mike's reply...
Sockets work in bytes, that's it. If you need to work with any other types
then you need to do the multiplication yourself to calculate the number of bytes
for a given type.
recv() is confusing with its char* type - it actually has nothing to do with
"characters" - it's just what the BYTE type was at the time it was designed.
It's ancient, and most wish it would go away.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hii all,
can anybody help me in reading event log files via windows APIs and c++.
Thanks in adavance...
T@SU
|
|
|
|
|
|
Thanks for your informatiion... but i what i am looking for..
i have to read AppEvent.Evt from ..system32/config and i have to extract the description... of error
thanks alot
T@SU
|
|
|
|
|
T@su wrote: i have to read AppEvent.Evt from ..system32/config...
You do not read the event file(s) directly. There is an API for doing that. Hans' article goes over all of this very well.
"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 am using dshow to play a video. (i am using dx9)
top of my project, i set,
#include <dshow.h>
#include <d3d9.h>
#include <vmr9.h>
...
in Debug, the program runs successfully,
when i changed to release, it has link error,
error LNK2001: unresolved external symbol _CLSID_NullRenderer
error LNK2001: unresolved external symbol _IID_ISampleGrabber
error LNK2001: unresolved external symbol _CLSID_SampleGrabber
error LNK2001: unresolved external symbol _IID_ICaptureGraphBuilder2
when i change Debug again, it can not be complied with the link error also.
do you have any idea?
thanks.
Lei
|
|
|
|
|
|
thx. it works.
|
|
|
|
|
Hello,
I am creating a installer for my application I am trying to execute custom action in InstallUISequence
Here is my code
<custom action="InstallSomething" before="InstallFinalize">PROP1=1 OR PROP2=1
Here i am setting PROP1 and PROP2 using checkboxes. The problem I am facing the condition is not working for custom action tag,
I am using Wix Installer version 2419.
Thanks in advance.
Abhi Lahare
|
|
|
|
|
Abhi Lahare wrote: I am using Wix Installer version 2419.
Buddy, it would be better you ask this question in WIX support forum, here i believe very few people are aware of this installer, generally people prefer installar shipped with VisualStudio or MacroVision Installshield on paid side and Innosetup on free side.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
you forgot NSIS :P
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|