cuowu

//////////////exe,cpp
#include "windows.h"

int main()
{
    HMODULE h=NULL;
    h=LoadLibrary("dll.DLL");
    InstHOOK insthook;
    while(1)
    {
        Sleep(100);
    }
    return 0;
}





// dll.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include "stdio.h"
#pragma data_seg ("ashared")
DWORD aa=2;
#pragma data_seg ()
#pragma   comment(linker,"/section:ashared,rws")  //这个很重要  少了个/问题解决
BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    char ssw[22];
    memset(ssw,0,sizeof(ssw));
    sprintf(ssw,"aa :  %d",aa);
    MessageBox(NULL,ssw,NULL,MB_OK);
    aa=1111;
    return TRUE;
}

你可能感兴趣的:(cuowu)