WTSFreeMemory is throwing ntdll.dll exception

  • Thread starter Thread starter aditya satya prakash
  • Start date Start date
A

aditya satya prakash

Guest
Hi All,

When I am executing the below function I am getting ntdll.dll exception.

From WTSFreeMemory(&pSessionInfo), sometimes I am getting the ntdll.dll exception in Windows 10 64-bit environment.

BOOL IsUserLoggedOn()
{
BOOL bResult = FALSE;

DWORD dwSessionId = 0;
DWORD dwSessionCount = 0;
DWORD dwTempSessionId = 0;

WTS_SESSION_INFO *pSessionInfo;

// Get array of WTS_SESSION_INFOs representing all sessions
if(WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE,
0,
1,
&pSessionInfo,
&dwSessionCount))
{
// Loop through sessions until we find one that's active
for(int i = 0; i <= (int)dwSessionCount; i++)
{
if(pSessionInfo.State == WTSActive)
{
bResult = TRUE;
break;
}
int w = 1;
}
}
WTSFreeMemory(&pSessionInfo);

return bResult;
}

Below is the exception:

Faulting application name: testserv.exe, version: 3.0.2.0, time stamp: 0x5ca3c70c
Faulting module name: ntdll.dll, version: 10.0.16299.64, time stamp: 0xac8afc81
Exception code: 0xc0000374
Fault offset: 0x000da849
Faulting process id: 0x18e8
Faulting application start time: 0x01d4f02674d33351
Faulting application path: C:\Program Files (x86)\EMR\testserv.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: d9738705-3c2a-482e-8ff5-02194c020c89
Faulting package full name:
Faulting package-relative application ID:


Could someone please help me the root cause of the issue?


Y A S Prakash

Continue reading...
 
Back
Top