Author Topic: Windows Defender Status / Enable - Disable  (Read 1506 times)

0 Members and 1 Guest are viewing this topic.

xC

  • Guest
Windows Defender Status / Enable - Disable
« on: May 07, 2013, 01:58:53 am »
Made this from the public documentation of the Windows Defender a couple years back.. not much use nowadays as the defender is quite obsolete.

Code: [Select]
#include <windows.h>
#include <stdio.h>


bool LoadFunctions( void );
bool WDStatus( void );
bool WDDisable( bool bEnable );


typedef HRESULT ( __stdcall *WDS )( BOOL* );
WDS fWDStatus;


typedef HRESULT ( __stdcall *WDE )( BOOL );
WDE fWDEnable;


bool LoadFunctions()
{
    char szBuffer[256];


    if( GetEnvironmentVariable( "ProgramFiles", szBuffer, sizeof( szBuffer ) ) )
    {
        strcat( szBuffer, "/Windows Defender/MpClient.dll" ); //
     
        HMODULE hMpClient = LoadLibrary( szBuffer );
        if( hMpClient != NULL)
        {
            fWDStatus = (WDS) GetProcAddress( hMpClient, "WDStatus" );
            fWDEnable = (WDE) GetProcAddress( hMpClient, "WDEnable" );
            if( fWDStatus != NULL || fWDEnable != NULL )
            {
                return( true );
            }
        }
    }
    return( false );
}


bool WDStatus()
{
    BOOL bStatus;
    HRESULT hResult = fWDStatus( &bStatus );
    if( hResult == S_OK ) {
        switch( bStatus ) {
        case TRUE:
            return( true );
        }
    }
    return( false );
}


bool WDDisable( bool bEnable ) //false = disable, true = enable
{
    HRESULT hResult = fWDEnable( bEnable );
    if( hResult == S_OK) {
        return( true );
    }
    return( false );
}


int main()
{
    if( LoadFunctions( ) == true ) {//loaded
        if( WDStatus( ) == true ) { //enabled
            WDDisable( false );     //disable
        }
    }
    getchar( );
   
    return( 0 );
}
« Last Edit: May 07, 2013, 02:43:53 am by xC »

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Windows Defender Status / Enable - Disable
« Reply #1 on: May 07, 2013, 07:59:22 am »
MS Defender is not obsolete, it is enabled in all newly installed systems and a regular douchebag doesn't know about it or doesn't care to turn it off.

xC

  • Guest
Re: Windows Defender Status / Enable - Disable
« Reply #2 on: May 07, 2013, 02:54:18 pm »
Maybe obsolete wasn't the best word for what I meant. However, it doesn't seem to detect much malicious activity. Also, thanks for your comment.
« Last Edit: May 07, 2013, 02:54:48 pm by xC »