Bug in C++ compiler?

  • Thread starter Thread starter Grant Bonnell
  • Start date Start date
G

Grant Bonnell

Guest
I am using Visual Visual Studio 2008. My boss has tasked me with creating a version of my program that will run on Windows XP. Since I can't use C++, does anyone know why the C++ compiler produces the following code?


/////////////////////////////////////////////////////////////////////
// DIALOG.CPP //
// //
// //
// This module contains all the dialog functions needed by the //
// program. //
// //
//////////////////////////////////////////////////////////////////////

#pragma comment(lib, "advapi32.lib")
#include <windows.h>
#include <stddef.h>
#include <stdlib.h>
#include <resource.h>
#include <aclAPI.h>

#include <defines.h>
#include <idefines.h>
#include <installStruct.hpp>
#include <imessages.h>
#include <Richedit.h>
#include <iexterns.hpp> // When this is included windows.h must also be.



//////////////////////////////////////////////////////////////////////
// getAdminSD //
// //
// //
// This function returns an Administrator SD. //
// //
//////////////////////////////////////////////////////////////////////
PSECURITY_DESCRIPTOR getAdminSD( void )
{
01174020 push esi
01174021 push edi

DWORD dwRes;
int SIDError=1;

// Create a SID for the BUILTIN Administrators group.
if( !AllocateAndInitializeSid( &SIDAuthNT, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pEveryoneSID))
01174022 push offset _pEveryoneSID (117759Ch)
01174027 xor edi,edi
01174029 push edi
0117402A push edi
0117402B push edi
0117402C push edi
0117402D push edi
0117402E push edi
0117402F push 220h
01174034 push 20h
01174036 mov esi,2
0117403B push esi
0117403C push offset _SIDAuthNT (1177018h)
01174041 call dword ptr [__imp__AllocateAndInitializeSid@44 (1175004h)]
01174047 test eax,eax
01174049 jne getAdminSD+3Bh (117405Bh)
{
#if MESSAGING_VERSION==TRUE

error_msg( MSG29, FATAL_DISPLAY_ERROR | YES_DISPLAY_STRING, GetLastError() );
0117404B call dword ptr [__imp__GetLastError@0 (11750A0h)]
01174051 mov esi,offset string "AllocateAndInitializeSid Failed!"... (1175C64h)
#endif
goto exit;
01174056 jmp getAdminSD+108h (1174128h)
}

// Initialize an EXPLICIT_ACCESS structure for an ACE.
// The ACE will allow Everyone read access to the key.
ZeroMemory(&ea, 2 * sizeof(EXPLICIT_ACCESS));
0117405B push 40h
0117405D push edi
0117405E push offset _ea (1179FA0h)
01174063 call memset (11749EEh)
ea[0].grfAccessPermissions = KEY_READ;
ea[0].grfAccessMode = SET_ACCESS;
ea[0].grfInheritance= NO_INHERITANCE;
ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
ea[0].Trustee.ptstrName = (LPTSTR) pEveryoneSID;
01174068 mov eax,dword ptr [_pEveryoneSID (117759Ch)]

// Initialize an EXPLICIT_ACCESS structure for an ACE.
// The ACE will allow the Administrators group full access to
// the key.
ea[1].grfAccessPermissions = KEY_ALL_ACCESS;
ea[1].grfAccessMode = SET_ACCESS;
ea[1].grfInheritance= NO_INHERITANCE;
ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID;
ea[1].Trustee.TrusteeType = TRUSTEE_IS_GROUP;
ea[1].Trustee.ptstrName = (LPTSTR) pAdminSID;
0117406D mov ecx,dword ptr [_pAdminSID (11775A0h)]
01174073 add esp,0Ch

// Initialize an EXPLICIT_ACCESS structure for an ACE.
// The ACE will allow Everyone read access to the key.
////myEa.grfAccessPermissions=0;
//myEa.grfAccessPermissions1=KEY_READ;
////myEa=0;
//myEa.grfAccessMode1 = SET_ACCESS;
//myEa.grfInheritance1= NO_INHERITANCE;
//myEa.Trustee.TrusteeForm1 = TRUSTEE_IS_SID;
//myEa.Trustee.TrusteeType1 = TRUSTEE_IS_WELL_KNOWN_GROUP;
//myEa.Trustee.ptstrName1 = (LPTSTR) pEveryoneSID;

// Create a SID for the BUILTIN\Administrators group.
//myEa.grfAccessPermissions2 = FILE_GENERIC_WRITE | FILE_GENERIC_READ;
//myEa.grfAccessMode2 = SET_ACCESS;
//myEa.grfInheritance2= NO_INHERITANCE;
//myEa.Trustee.TrusteeForm2 = TRUSTEE_IS_SID;
//myEa.Trustee.TrusteeType2 = TRUSTEE_IS_GROUP;
//myEa.Trustee.ptstrName2 = (LPSTR) pAdminSID;
// Create a new ACL that contains the new ACEs.
dwRes = SetEntriesInAcl( 2, &ea[2], NULL, &pACL);
01174076 push offset _pACL (11775A4h)
0117407B push edi
0117407C push offset _szSystem32Dir (1179FE0h)
01174081 push esi
01174082 mov dword ptr [_ea (1179FA0h)],20019h
0117408C mov dword ptr [_ea+4 (1179FA4h)],esi
01174092 mov dword ptr [_ea+8 (1179FA8h)],edi
01174098 mov dword ptr [_ea+14h (1179FB4h)],edi
0117409E mov dword ptr [_ea+18h (1179FB8h)],5
011740A8 mov dword ptr [_ea+1Ch (1179FBCh)],eax
011740AD mov dword ptr [_ea+20h (1179FC0h)],0F003Fh
011740B7 mov dword ptr [_ea+24h (1179FC4h)],esi
011740BD mov dword ptr [_ea+28h (1179FC8h)],edi
011740C3 mov dword ptr [_ea+34h (1179FD4h)],edi
011740C9 mov dword ptr [_ea+38h (1179FD8h)],esi
011740CF mov dword ptr [_ea+3Ch (1179FDCh)],ecx
011740D5 call dword ptr [__imp__SetEntriesInAclA@16 (1175000h)]
if (ERROR_SUCCESS != dwRes)
011740DB cmp eax,edi
011740DD je getAdminSD+0C6h (11740E6h)
{

Continue reading...
 
Back
Top