Click here to Skip to main content
15,895,084 members
Articles / Containers / Virtual Machine

Writing a Parental Control Software for Windows

Rate me:
Please Sign up or sign in to vote.
4.78/5 (9 votes)
8 Jul 2010GPL39 min read 57.1K   2.7K   28  
Writing a parental control software: The beginning of the adventure
#pragma unmanaged

#include "StdAfx.h"

#include "Types.h"
#include "GlobalVars.h"


//
// Function: DllMain
//
// Description:
//    Provides initialization when the LSP DLL is loaded. In our case we simply,
//    initialize some critical sections used throughout the DLL.
//
//BOOL WINAPI 
//DllMain(
//    IN HINSTANCE hinstDll, 
//    IN DWORD dwReason, 
//    LPVOID lpvReserved
//    )
//{
//    switch (dwReason)
//    {
//
//        case DLL_PROCESS_ATTACH:
//			
//        case DLL_THREAD_ATTACH:
//            break;
//
//        case DLL_THREAD_DETACH:
//            break;
//
//        case DLL_PROCESS_DETACH:
//            break;
//    }
//
//    return TRUE;
//
//cleanup:
//
//    return FALSE;
//}


void dbgprint(
    char *format,
    ...
    )
{
    static  DWORD pid=0;
    va_list vl;
    char    dbgbuf1[2048],
            dbgbuf2[2048];

    // Prepend the process ID to the message
    if ( 0 == pid )
    {
        pid = GetCurrentProcessId();
    }

    EnterCriticalSection(&GlobalVars::gDebugCritSec);
    va_start(vl, format);
    StringCbVPrintf(dbgbuf1, sizeof(dbgbuf1),format, vl);
    StringCbPrintf(dbgbuf2, sizeof(dbgbuf2),"%lu: %s\r\n", pid, dbgbuf1);
    va_end(vl);

    OutputDebugString(dbgbuf2);
    LeaveCriticalSection(&GlobalVars::gDebugCritSec);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
France France
I am a French programmer.
These days I spend most of my time with the .NET framework, JavaScript and html.

Comments and Discussions