Click here to Skip to main content
15,913,836 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPlaying wav through streaming buffer Pin
Sivaji16-Mar-04 2:32
Sivaji16-Mar-04 2:32 
Generalshould not open a file in the IE when i dragged it into activex control Pin
jillellamudi16-Mar-04 2:04
jillellamudi16-Mar-04 2:04 
Generalmfc dll version Pin
ppp00116-Mar-04 1:19
ppp00116-Mar-04 1:19 
GeneralRe: mfc dll version Pin
Nirav Doshi16-Mar-04 1:28
Nirav Doshi16-Mar-04 1:28 
GeneralRe: mfc dll version Pin
David Crow16-Mar-04 2:31
David Crow16-Mar-04 2:31 
GeneralRe: mfc dll version Pin
RChin16-Mar-04 1:48
RChin16-Mar-04 1:48 
GeneralRe: mfc dll version Pin
Prakash Nadar16-Mar-04 2:38
Prakash Nadar16-Mar-04 2:38 
GeneralQuery: Keyboard Hooks! Pin
Nirav Doshi16-Mar-04 1:14
Nirav Doshi16-Mar-04 1:14 
Hello,

I have an application which hooks up the keyboard of a given process by injecting a DLL into the process.

Now in that DLL, I have a (shared) char buffer which stores each keystroke. I am trying to get the buffer from my application, which is failing! Is there anything I am missing here? Unsure | :~ :

Here's how my code goes:

<code>
...
#pragma data_seg(".WBA")
char	g_chBuffer[0x101];
#pragma data_seg()
#pragma comment(linker, "/section:.WBA,rws")

...
BOOL _declspec(dllexport) __stdcall GetAppBuffer(char *chfBufferOut)
{
    if(chfBufferOut == NULL)
    {
	return	FALSE;
    }

    char *pchBuffer = g_chBuffer;               // Here somehow, g_chBuffer is EMPTY! :((

    while((*chfBufferOut++ = *pchBuffer++) != 0);

    return	TRUE;
}
...

LRESULT _declspec(dllexport) CALLBACK GetKeyboardMsgs(int nCode, WPARAM wParam, LPARAM lParam)
{
...
    static char *pchBuffer = g_chBuffer;
...
    ToAscii(wParam, nScan, chKeyState, &wTemp, 0);
    *pchBuffer++ = char(wTemp);                      // The buffer is fine here
...
}
</code>


In my application code, where I am calling the function GetAppBuffer():
...MyFunction()
{
...
    static BOOL (__stdcall *fpGetAppBuffer)(char *) = NULL;
    if(m_hmodDLL != NULL)
    {
	memset(chBuffer, STRING_TERMINATOR, 0x101);
	fpGetAppBuffer = (BOOL (__stdcall *)(char *)) GetProcAddress(m_hmodDLL, "GetAppBuffer");
    }
...
    char chBuffer[0x101];
    memset(chBuffer, 0, 0x101);
    fpGetAppBuffer(chBuffer);            // It gets an empty chBuffer back! :(
....
}
</code>


Please reply with any of your comments/suggestions. Is there anything wrong, that I am doing here? Please write back even if you feel the question/code is not clear/insufficient.

Thanks!
Rgds,

Nirav

* Don't wish it was easier, wish you were better! *
Generaltree icon [+] [-] Pin
s o v a n n16-Mar-04 1:05
s o v a n n16-Mar-04 1:05 
GeneralRe: tree icon [+] [-] Pin
João Paulo Figueira16-Mar-04 1:26
professionalJoão Paulo Figueira16-Mar-04 1:26 
GeneralRe: tree icon [+] [-] Pin
s o v a n n17-Mar-04 2:57
s o v a n n17-Mar-04 2:57 
Questionmay i get the source code of palm encryption &amp; decryption?? Pin
c028121916-Mar-04 1:03
c028121916-Mar-04 1:03 
Generaldeploying a .dll dependent on MFC71.dll Pin
Andy C16-Mar-04 0:37
Andy C16-Mar-04 0:37 
Generalunsigned long to string Pin
Caoimh16-Mar-04 0:17
Caoimh16-Mar-04 0:17 
GeneralRe: unsigned long to string Pin
jmkhael16-Mar-04 0:29
jmkhael16-Mar-04 0:29 
GeneralRe: unsigned long to string Pin
Caoimh16-Mar-04 0:32
Caoimh16-Mar-04 0:32 
GeneralRe: unsigned long to string Pin
jmkhael16-Mar-04 0:35
jmkhael16-Mar-04 0:35 
GeneralRe: unsigned long to string Pin
Roger Allen16-Mar-04 4:02
Roger Allen16-Mar-04 4:02 
GeneralRe: unsigned long to string Pin
Prakash Nadar16-Mar-04 0:31
Prakash Nadar16-Mar-04 0:31 
GeneralRe: unsigned long to string Pin
Caoimh16-Mar-04 0:45
Caoimh16-Mar-04 0:45 
GeneralRe: unsigned long to string Pin
Rory Solley16-Mar-04 0:33
Rory Solley16-Mar-04 0:33 
GeneralDBase File Pin
Rassul Yunussov16-Mar-04 0:03
Rassul Yunussov16-Mar-04 0:03 
GeneralRe: DBase File Pin
Antti Keskinen16-Mar-04 0:42
Antti Keskinen16-Mar-04 0:42 
GeneralRe: DBase File Pin
basementman16-Mar-04 4:10
basementman16-Mar-04 4:10 
GeneralI have tried everyThing... Pin
Pazzuzu15-Mar-04 23:55
Pazzuzu15-Mar-04 23:55 

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.