rtl

RtlUnsubscribeWnfNotificationWaitForCompletion()

// flush.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <Windows.h>
#include <wtsapi32.h>
#pragma comment (lib,"Wtsapi32.lib ")

int _tmain(int argc, _TCHAR* argv[])
{
/*
typedef void(__stdcall*NTPROC)();  
HINSTANCE hinst = LoadLibrary(L"ntdll.dll");  
DWORD dwMajor = 0;  
if(hinst)
{
printf("1234234\n");
NTPROC proc = (NTPROC)GetProcAddress(hinst, "RtlUnsubscribeWnfNotificationWaitForCompletion");   
if(proc)
{
printf("22222222221234234");
proc();  

}
}
if(hinst)
FreeLibrary(hinst);
*/

	BOOL bResult=FALSE;
	DWORD dwSessionID=0xFFFFFFFF;
	WTS_SESSION_INFO *sessionInfo = NULL;
	DWORD sessionInfoCount=0;
	char strWinStationName[MAX_PATH]={0};

	BOOL result = WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &sessionInfo, &sessionInfoCount);

	for(unsigned int i = 0; i < sessionInfoCount; i++)
	{
		if( (sessionInfo[i].State == WTSActive) )//|| (sessionInfo[i].State == WTSDisconnected) )
		{
			return true;
		}
	}
	WTSFreeMemory(sessionInfo); //释放

	return 0;
}

  

 

typedef void(__stdcall*NTPROC)(DWORD*);  
HINSTANCE hinst = LoadLibrary(L"ntdll.dll");  
DWORD dwMajor = 0;  
if(hinst)
{
printf("1234234\n");
NTPROC proc = (NTPROC)GetProcAddress(hinst, "NtUpdateWnfStateData");   
if(proc)
{
printf("22222222221234234");
proc(&dwMajor);  

}
}
if(hinst)
FreeLibrary(hinst);

  

posted on 2020-06-24 16:26  lydstory  阅读(262)  评论(0)    收藏  举报

导航