Click here to Skip to main content
15,907,326 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi, I have the following WINAPI function.
C++
#include <windows.h>
#include <winwlx.h>

int WINAPI WlxLoggedOnSAS(PVOID pWlxContext,DWORD dwSasType,PVOID pReserved)
{
if (dwSasType == WLX_SAS_TYPE_CTRL_ALT_DEL)
{
// Add additional code of you own
::MessageBox(HWND_DESKTOP,"Unable to LoggOff!","help",MB_OK);
return WLX_SAS_ACTION_NONE;
}
else return GWlxLoggedOnSAS( pWlxContext, dwSasType, pReserved );
}

When I build I get undeclared identifier GWlxLoggedOnSAS

Note: GWlxLoggedOnSAS is different from WilxLoggedOnSAS.

Also, I am not sure if this is the way to call it,
C++
while (1==1) { CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)&WlxLoggedOnSAS, 0, 0, NULL); }


Thanks in advance...
Posted
Updated 9-Feb-11 21:21pm
v12

The function you use with CreateThread can have only a void * argument; see MSDN docs on a ThreadProc Callback Function[^]. To use your other arguments, you'd have to make a struct like so;
struct
{
    PVOID pWlxContext;
    DWORD dwSasType;
    PVOID pReserved;
}threadparams;


and pass a pointer to that to CreateThread:
CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)&WlxLoggedOnSAS, (void*)&threadparams, 0, NULL);


And receive it like so:
DWORD WINAPI WlxLoggedOnSAS(void *threadparams)
{
    struct
    {
        PVOID pWlxContext;
        DWORD dwSasType;
        PVOID pReserved;
    }*tp = threadparams;

    // Rest of your function goes here


You might want to make the struct static in your calling function if you think it will be destroyed by scope before the WlxLoggedOnSAS thread is done with them.
 
Share this answer
 
v2
what about GWlxLoggedOnSAS, how to define it?
I was told that this function is only good until Windows XP, not for VISTA or 7.
Is that true? How to define for VISTA and 7?
 
Share this answer
 
You need the header file declaring the GWlxLoggedOnSAS. As far as I know it isn't one of the functions exported by the GINA.DLL.
:)
 
Share this answer
 
I have already included

#include <winwlx.h>

I am not sure whaT ELSE MUST BE INCLUDED FOR GWlxLoggedOnSAS.
 
Share this answer
 
So what I got so far:
#include <Winwlx.h>
#include <windows.h>
DWORD WINAPI WlxLoggedOnSAS(void *threadparams)
{ struct Wlx
    {
        PVOID pWlxContext;
        DWORD dwSasType;
        PVOID pReserved;
    } *tp = threadparams;

   if (tp->dwSasType == WLX_SAS_TYPE_CTRL_ALT_DEL)
  {
    // Add additional code of you own 
    ::MessageBox(HWND_DESKTOP,"Unable to LoggOff!","help",MB_OK);
    return WLX_SAS_ACTION_NONE;
  }
else return GWlxLoggedOnSAS( tp->pWlxContext,tp->dwSasType, tp->pReserved );

}</windows.h>


This is MFC project web dialog base, i am not sure how to call it , because I wanted to intercept CTLR+ALT+DEL buttons but dialog has to return, so i am not sure how to call it?

CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)&WlxLoggedOnSAS, (void*)&threadparams, 0, NULL);


I still get 2 errors:

MSIL
initializing' : cannot convert from 'void *' to 'WlxLoggedOnSAS::Wlx *'
1>        Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>f:\documents and settings\owner\my documents\visual studio 2008\projects\mfc_application\mfc_application\mfc_applicationdlg.cpp(741) : error C3861: 'GWlxLoggedOnSAS': identifier not found
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900