老问题:进程插入的疑问 不懂。但可以写日志,看Dll的代码是否被执行 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在DLL的代码里加是否执行成功的判断,把判断结果写进一个文本里,你查看文本就知道Dll的代码是否被执行 Winlogon和你不在一个桌面上,它有自己的桌面的 http://support.microsoft.com/kb/171890 查查Window Stations and Desktops 恩,因为不是一个桌面上,如果你的系统是2000就好办了,直接点Ctrl+Alt+Delete就能看到你插入的那个对话框了。XP默认那个桌面是不给你看的,按Ctrl+Alt+Delete出来的是任务管理器,XP下搞出来那个桌面也是可以的,但是我忘了怎么搞了,呵呵~~ 估计你是写注入程序,或者BHO类的东东,其实你如果是从事这样的工作,要熟悉一系列这样的工具和有一定的调试水平,看到你的回答好像很牵强哦,呵呵。。----quote----(谢谢你的回答。但是日志我不会写。)其实你直接通过processview就可以查看到加载的模块了 ^_^当然最好是调试跟踪了, 不同的系统进程空间吧!一个系统的,一个是用户的!在系统进程空间中打MessageBox你在用户进程空间是看不到的! 下面代码演示了如何创建与用户交互的窗口:#include "stdafx.h"HWND g_hWnd; //主窗口句柄,一般程序中经常用到此变量,故使用全局变量 HINSTANCE g_hInst; //应用程序进程句柄,一般程序中经常用到此变量,故使用全局变量 const char c_szAppName[] = "MiniPE"; //////////////////////////////////////////////////////////////////////////////////////////////////// //函数声明 LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); int WINAPI myMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) { MSG sMsg; WNDCLASSEX sWndClassEx; g_hInst = hInstance; sWndClassEx.cbSize = sizeof(WNDCLASSEX); sWndClassEx.style = CS_VREDRAW | CS_HREDRAW; sWndClassEx.lpfnWndProc = (WNDPROC) WindowProc; sWndClassEx.cbClsExtra = 0; sWndClassEx.cbWndExtra = 0; sWndClassEx.hInstance = g_hInst; sWndClassEx.hIcon = NULL;//LoadIcon(NULL, IDI_APPLICATION); sWndClassEx.hCursor = LoadCursor(NULL, IDC_ARROW); sWndClassEx.hbrBackground = (HBRUSH) (COLOR_WINDOW); sWndClassEx.lpszMenuName = NULL; sWndClassEx.lpszClassName = c_szAppName; sWndClassEx.hIconSm = NULL; RegisterClassEx(&sWndClassEx); g_hWnd = CreateWindowEx(WS_EX_TOPMOST, c_szAppName, c_szAppName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, g_hInst, NULL); ShowWindow(g_hWnd, iCmdShow); UpdateWindow(g_hWnd); while (GetMessage(&sMsg, NULL, 0, 0)) { TranslateMessage(&sMsg); DispatchMessage(&sMsg); } return((int) sMsg.wParam); } //////////////////////////////////////////////////////////////////////////////////////////////////// //主窗口回调函数 LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_DESTROY: PostQuitMessage(0); break; default: return(DefWindowProc(hWnd, uMsg, wParam, lParam)); } return(0); } BOOL ThreadInteract(void){ HDESK hdeskCurrent; HDESK hdeskTest; HDESK hdesk; HWINSTA hwinstaCurrent; HWINSTA hwinsta; // // Save the current Window station // hwinstaCurrent = GetProcessWindowStation(); if (hwinstaCurrent == NULL) return FALSE; // // Save the current desktop // hdeskCurrent = GetThreadDesktop(GetCurrentThreadId()); if (hdeskCurrent == NULL) return FALSE; // // Obtain a handle to WinSta0 - service must be running // in the LocalSystem account // hwinsta = OpenWindowStation("winsta0", FALSE, WINSTA_ACCESSCLIPBOARD | WINSTA_ACCESSGLOBALATOMS | WINSTA_CREATEDESKTOP | WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_EXITWINDOWS | WINSTA_READATTRIBUTES | WINSTA_READSCREEN | WINSTA_WRITEATTRIBUTES); if (hwinsta == NULL) return FALSE; // // Set the windowstation to be winsta0 // if (!SetProcessWindowStation(hwinsta)) return FALSE; // // Get the desktop // hdeskTest = GetThreadDesktop(GetCurrentThreadId()); if (hdeskTest == NULL) return FALSE; // // Get the default desktop on winsta0 // hdesk = OpenDesktop("default", 0, FALSE, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD | DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS); if (hdesk == NULL) return FALSE; // // Set the desktop to be "default" // if (!SetThreadDesktop(hdesk)) return FALSE; // // Do a message box // MessageBox(NULL, "MB_OK", "test_interact", MB_OK); // // Reset the Window station and desktop // if (!SetProcessWindowStation(hwinstaCurrent)) return FALSE; if (!SetThreadDesktop(hdeskCurrent)) return FALSE; // // Close the windowstation and desktop handles // if (!CloseWindowStation(hwinsta)) return FALSE; if (!CloseDesktop(hdesk)) return FALSE; return TRUE;}int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ // TODO: Place code here. HWINSTA hSta = OpenWindowStation("WinSta0", 1, -1); ThreadInteract(); myMain(hInstance, 0, 0, 1); return 0;} 如何销毁一个Dlg框 wsasocket 为什么调用失败 CObject类赋值 关于字符串的简单问题 高手指教啊!我的控制台程序退出时,那个黑黑的屏幕却怎样也关不了 CFile创建目录和文件!? 如何限定只能在交点处才能下到棋子?急!急! 如何实现基于对话框的程序不在任务条里显示? 拜求:运动车辆的检测的方法后代码 vc++ MFC 编辑对话框 ID 号 在添加消息响应函数时 读不出来 如何根据快捷方式文件去得到进程名? 请问如何使用SQLAPI连接informix数据库
XP默认那个桌面是不给你看的,按Ctrl+Alt+Delete出来的是任务管理器,XP下搞出来那个桌面也是可以的,但是我忘了怎么搞了,呵呵~~
看到你的回答好像很牵强哦,呵呵。。----quote----(谢谢你的回答。但是日志我不会写。)
其实你直接通过processview就可以查看到加载的模块了 ^_^
当然最好是调试跟踪了,
#include "stdafx.h"
HWND g_hWnd; //主窗口句柄,一般程序中经常用到此变量,故使用全局变量
HINSTANCE g_hInst; //应用程序进程句柄,一般程序中经常用到此变量,故使用全局变量
const char c_szAppName[] = "MiniPE";
////////////////////////////////////////////////////////////////////////////////////////////////////
//函数声明
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); int WINAPI myMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
{
MSG sMsg;
WNDCLASSEX sWndClassEx; g_hInst = hInstance; sWndClassEx.cbSize = sizeof(WNDCLASSEX);
sWndClassEx.style = CS_VREDRAW | CS_HREDRAW;
sWndClassEx.lpfnWndProc = (WNDPROC) WindowProc;
sWndClassEx.cbClsExtra = 0;
sWndClassEx.cbWndExtra = 0;
sWndClassEx.hInstance = g_hInst;
sWndClassEx.hIcon = NULL;//LoadIcon(NULL, IDI_APPLICATION);
sWndClassEx.hCursor = LoadCursor(NULL, IDC_ARROW);
sWndClassEx.hbrBackground = (HBRUSH) (COLOR_WINDOW);
sWndClassEx.lpszMenuName = NULL;
sWndClassEx.lpszClassName = c_szAppName;
sWndClassEx.hIconSm = NULL;
RegisterClassEx(&sWndClassEx); g_hWnd = CreateWindowEx(WS_EX_TOPMOST, c_szAppName, c_szAppName, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, g_hInst, NULL);
ShowWindow(g_hWnd, iCmdShow);
UpdateWindow(g_hWnd); while (GetMessage(&sMsg, NULL, 0, 0))
{
TranslateMessage(&sMsg);
DispatchMessage(&sMsg);
}
return((int) sMsg.wParam);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//主窗口回调函数
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break; default:
return(DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return(0);
}
BOOL ThreadInteract(void)
{
HDESK hdeskCurrent;
HDESK hdeskTest;
HDESK hdesk;
HWINSTA hwinstaCurrent;
HWINSTA hwinsta;
//
// Save the current Window station
//
hwinstaCurrent = GetProcessWindowStation();
if (hwinstaCurrent == NULL)
return FALSE;
//
// Save the current desktop
//
hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());
if (hdeskCurrent == NULL)
return FALSE;
//
// Obtain a handle to WinSta0 - service must be running
// in the LocalSystem account
//
hwinsta = OpenWindowStation("winsta0", FALSE,
WINSTA_ACCESSCLIPBOARD |
WINSTA_ACCESSGLOBALATOMS |
WINSTA_CREATEDESKTOP |
WINSTA_ENUMDESKTOPS |
WINSTA_ENUMERATE |
WINSTA_EXITWINDOWS |
WINSTA_READATTRIBUTES |
WINSTA_READSCREEN |
WINSTA_WRITEATTRIBUTES);
if (hwinsta == NULL)
return FALSE;
//
// Set the windowstation to be winsta0
//
if (!SetProcessWindowStation(hwinsta))
return FALSE;
//
// Get the desktop
//
hdeskTest = GetThreadDesktop(GetCurrentThreadId());
if (hdeskTest == NULL)
return FALSE;
//
// Get the default desktop on winsta0
//
hdesk = OpenDesktop("default", 0, FALSE,
DESKTOP_CREATEMENU |
DESKTOP_CREATEWINDOW |
DESKTOP_ENUMERATE |
DESKTOP_HOOKCONTROL |
DESKTOP_JOURNALPLAYBACK |
DESKTOP_JOURNALRECORD |
DESKTOP_READOBJECTS |
DESKTOP_SWITCHDESKTOP |
DESKTOP_WRITEOBJECTS);
if (hdesk == NULL)
return FALSE;
//
// Set the desktop to be "default"
//
if (!SetThreadDesktop(hdesk))
return FALSE;
//
// Do a message box
//
MessageBox(NULL, "MB_OK", "test_interact", MB_OK);
//
// Reset the Window station and desktop
//
if (!SetProcessWindowStation(hwinstaCurrent))
return FALSE;
if (!SetThreadDesktop(hdeskCurrent))
return FALSE;
//
// Close the windowstation and desktop handles
//
if (!CloseWindowStation(hwinsta))
return FALSE;
if (!CloseDesktop(hdesk))
return FALSE;
return TRUE;
}int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
HWINSTA hSta = OpenWindowStation("WinSta0", 1, -1);
ThreadInteract();
myMain(hInstance, 0, 0, 1);
return 0;
}