Advertisement

12.30.2005 at 07:00AM PST, ID: 21679322
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Code implementation walk through

Asked by gideonn in Microsoft Visual C++.Net

Tags: , ,

I am a VB coder, and I taugh myself that...  I really have had very little exposure to VC++ or any C lang to be honest...  I am trying to implement the following code using the MSFT Visual C++ 2005 Express app that is avialable online and I just don't know enough about C to begin to understand how everything works, or how to actually utilize the code that is provided.  Any assistance would be greatly appreciated.  I have assigned 500 points however if someone is willing to walk me through the coding process (Since I am only using C this one time) I will create another points question for the individual that answers the question.  I just want this to be an EXE to be executed without any interface (If possible)...

Code I want to use...

Here is a slightly modified LOCKWS.CPP from the "Locking a window station" example which emulates C-A-D if you run LOCK.EXE:

// lockws.cpp

#define STRICT
#include <windows.h>
#include <fstream.h>

HINSTANCE   hDll;
CHAR        libName[MAX_PATH];
HDESK       hWinlogon;
HANDLE      hThread=0;
DWORD       dwThreadId;
HWND        hGeneric,hDialog;
PSECURITY_DESCRIPTOR psd;

// Log files
//ofstream o("C:\\out");
//ofstream o2("C:\\out2");

DWORD WINAPI threadProc(LPVOID);

//---------------------------------------------------------------------------
//
// Finds Winlogon generic control dialog
//
BOOL CALLBACK findGeneric(HWND hwnd,LPARAM)
{
   CHAR text[1024];
   GetWindowText(hwnd,text,sizeof(text));
   if(!strcmp(text,"Winlogon generic control dialog")) {
      hGeneric=hwnd;
      return FALSE;
   }
   return TRUE;
}
//---------------------------------------------------------------------------
//
// Finds Windows NT security dialog
//
BOOL CALLBACK findDialog(HWND hwnd,LPARAM)
{
   CHAR text[1024];
   GetWindowText(hwnd,text,sizeof(text));
   //o2<<text<<' '<<hwnd<<endl;
   if(!strcmp(text,"Windows NT Security")) {
      hDialog=hwnd;
      return FALSE;
   }
   return TRUE;
}
//---------------------------------------------------------------------------
BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID)
{
   if(fdwReason==DLL_PROCESS_ATTACH) {
      //MessageBeep(-1);
      hDll=hinstDLL;
      GetModuleFileName(hDll,libName,sizeof(libName));

      hWinlogon=OpenDesktop("Winlogon",0,FALSE,
         //DESKTOP_CREATEMENU  |
         //DESKTOP_CREATEWINDOW |
         DESKTOP_ENUMERATE |
         //DESKTOP_HOOKCONTROL |
         //DESKTOP_JOURNALPLAYBACK |
         //DESKTOP_JOURNALRECORD |
         DESKTOP_READOBJECTS
         //DESKTOP_SWITCHDESKTOP |
         //DESKTOP_WRITEOBJECTS
      );
      //o<<"hWinlogon="<<hWinlogon<<endl;

      hThread=CreateThread(0,0,threadProc,0,0,&dwThreadId);
      //o<<"hThread="<<hThread<<endl;

      //if(hThread) {
         // Make sure we are remain after NINJLIB.EXE
         //LoadLibrary(libName);
      //}
   }
   else if(fdwReason==DLL_PROCESS_DETACH) {
      //MessageBeep(-1);
      if(hThread) {
         TerminateThread(hThread,0);
         CloseHandle(hThread);
      }
      CloseDesktop(hWinlogon);
   }

   return TRUE;
}
//---------------------------------------------------------------------------
DWORD WINAPI threadProc(LPVOID)
{
   psd=(PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
      SECURITY_DESCRIPTOR_MIN_LENGTH);
   InitializeSecurityDescriptor(psd,SECURITY_DESCRIPTOR_REVISION);
   SetSecurityDescriptorDacl(psd,TRUE,0,FALSE);
   SECURITY_ATTRIBUTES sa={
      sizeof(SECURITY_ATTRIBUTES),
      psd,
      FALSE
   };

   HANDLE hEvent=CreateEvent(&sa,FALSE,FALSE,"Nick Lock Station");
   //o2<<"hEvent="<<hEvent<<endl;
   if(hEvent) {
      while(1) {
         //MessageBeep(-1);
         DWORD r=WaitForSingleObject(hEvent,INFINITE);
         if(r==WAIT_OBJECT_0) {
            HWND w=FindWindow("SAS window class","SAS window");
            SendMessage(w,WM_HOTKEY,0,MAKELPARAM(MOD_ALT|MOD_CONTROL,VK_DELETE));
         }
      }
   }
   return 0;
}

-----------------BREAK-------------------

Links I have so far on the topic...

http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_10942141.html
http://www.derkeiler.com/Newsgroups/microsoft.public.platformsdk.security/2004-02/0498.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20903474.html?query=&clearTAFilter=true

Thank you for any help!Start Free Trial
[+][-]12.30.2005 at 08:05AM PST, ID: 15578411

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.30.2005 at 08:20AM PST, ID: 15578514

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.30.2005 at 08:32AM PST, ID: 15578583

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.30.2005 at 12:39PM PST, ID: 15580226

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.30.2005 at 12:52PM PST, ID: 15580312

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.31.2005 at 07:39AM PST, ID: 15583777

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.04.2006 at 10:13AM PST, ID: 15610053

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.05.2006 at 05:03AM PST, ID: 15617457

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.17.2006 at 03:45PM PST, ID: 15724636

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.17.2006 at 05:43PM PST, ID: 15725205

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.18.2006 at 07:11AM PST, ID: 15729571

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.18.2006 at 08:03AM PST, ID: 15730090

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual C++.Net
Tags: from, char, 1
Sign Up Now!
Solution Provided By: lakshman_ce
Participating Experts: 1
Solution Grade: A
 
 
[+][-]01.18.2006 at 09:21AM PST, ID: 15730892

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-39