1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Eliminate compiler warnings on VC++ 14 and CLang.

Remove unused stuff from OSD_WNT.cxx.
This commit is contained in:
abv
2015-12-18 07:00:44 +03:00
parent 20aeeb7be3
commit d677b21418
8 changed files with 18 additions and 337 deletions

View File

@@ -518,162 +518,8 @@ void FreeFileSecurity ( PSECURITY_DESCRIPTOR pSD ) {
HeapFree ( hHeap, 0, ( LPVOID )pSD );
} /* end FreeFileSecurity */
/***/
/******************************************************************************/
/* Function : LookupAccountSidEx */
/* Purpose : Looking for account corresponding to the given SID and returns*/
/* a name of that account on success */
/* Returns : TRUE if account was found in the security database */
/* FALSE otherwise */
/* Warning : If account was found then this function allocates memory */
/* needed to hold the name of that account and the name of the */
/* domain to which this account belongs. To free that memoty */
/* use 'FreeAccountNames' function */
/******************************************************************************/
/***/
#if defined(__CYGWIN32__) || defined(__MINGW32__)
#define __try
#define __finally
#define __leave return retVal
#endif
BOOL LookupAccountSidEx ( PSID pSID, LPWSTR* name, LPWSTR* domain ) {
DWORD errVal;
DWORD dwSizeName = 0;
DWORD dwSizeDomain = 0;
BOOL retVal = FALSE;
SID_NAME_USE eUse;
__try {
do {
errVal = ERROR_SUCCESS;
if ( !LookupAccountSidW (
NULL, pSID, *name, &dwSizeName, *domain, &dwSizeDomain, &eUse
)
) {
if ( ( errVal = GetLastError () ) != ERROR_INSUFFICIENT_BUFFER ) __leave;
if ( ( *name = ( LPWSTR )HeapAlloc ( hHeap, 0, dwSizeName ) ) == NULL ||
( *domain = ( LPWSTR )HeapAlloc ( hHeap, 0, dwSizeDomain ) ) == NULL
) __leave;
} /* end if */
} while ( errVal != ERROR_SUCCESS );
retVal = TRUE;
} /* end __try */
__finally {
if ( !retVal ) {
if ( *name == NULL ) HeapFree ( hHeap, 0, *name );
if ( *domain == NULL ) HeapFree ( hHeap, 0, *domain );
} /* end if */
} /* end __finally */
#ifdef VAC
leave: ; // added for VisualAge
#endif
return retVal;
} /* end LookupAccountSidEx */
#if defined(__CYGWIN32__) || defined(__MINGW32__)
#undef __try
#undef __finally
#undef __leave
#endif
/***/
/******************************************************************************/
/* Function : FreeAccountNames */
/* Purpose : Deallocates memory which was allocated by the */
/* 'LookupAccountSidEx' function */
/******************************************************************************/
/***/
void FreeAccountNames ( LPWSTR lpszName, LPWSTR lpszDomain ) {
HeapFree ( hHeap, 0, ( PVOID )lpszDomain );
HeapFree ( hHeap, 0, ( PVOID )lpszName );
} /* end FreeAccountNames */
/***/
/******************************************************************************/
/* Function : GetSecurityDescriptorOwnerEx */
/* Purpose : Returns owner SID in the specified security descriptor. */
/* If specified security descriptor does not have an owner field */
/* then returns NULL */
/******************************************************************************/
/***/
PSID GetSecurityDescriptorOwnerEx ( PSECURITY_DESCRIPTOR pSD ) {
BOOL bDummy;
PSID retVal;
if ( !GetSecurityDescriptorOwner ( pSD, &retVal, &bDummy ) )
retVal = NULL;
return retVal;
} /* end GetSecurityDescriptorOwnerEx */
/***/
/******************************************************************************/
/* Function : GetSecurityDescriptorGroupEx */
/* Purpose : Returns primary group SID in the specified security */
/* descriptor. If specified security descriptor does not have a */
/* primary group field then returns NULL */
/******************************************************************************/
/***/
PSID GetSecurityDescriptorGroupEx ( PSECURITY_DESCRIPTOR pSD ) {
BOOL bDummy;
PSID retVal;
if ( !GetSecurityDescriptorGroup ( pSD, &retVal, &bDummy ) )
retVal = NULL;
return retVal;
} /* end GetSecurityDescriptorGroupEx */
/***/
/******************************************************************************/
/* Function : GetSecurityDescriptorDaclEx */
/* Purpose : Returns a pointer to the discretionary access-control list in */
/* the specified security descriptor. If specified security */
/* descriptor does not have a discretionary access-control list */
/* then returns NULL */
/******************************************************************************/
/***/
PACL GetSecurityDescriptorDaclEx ( PSECURITY_DESCRIPTOR pSD ) {
PACL retVal;
BOOL bDummy;
BOOL fPresent;
if ( !GetSecurityDescriptorDacl ( pSD, &fPresent, &retVal, &bDummy ) ||
!fPresent
)
retVal = NULL;
return retVal;
} /* end GetSecurityDescriptorDaclEx */
/***/
/******************************************************************************/
/* Function : CreateAcl */
/* Purpose : Allocates and initializes access-control list */
@@ -707,140 +553,7 @@ void FreeAcl ( PACL pACL ) {
HeapFree ( hHeap, 0, ( PVOID )pACL );
} /* end FreeAcl */
/***/
/******************************************************************************/
/* Function : CopySidEx */
/* Purpose : Makes a copy of the SID */
/* Returns : Pointer to the copy of the specified SID on success, */
/* NULL otherwise */
/* Warning : Allocated SID must be deallocated by 'FreeSidEx' function */
/******************************************************************************/
/***/
PSID CopySidEx ( PSID pSIDsrc ) {
DWORD dwLen;
PSID retVal;
dwLen = GetLengthSid ( pSIDsrc );
retVal = ( PSID )HeapAlloc ( hHeap, 0, dwLen );
if ( retVal != NULL )
CopySid ( dwLen, retVal, pSIDsrc );
return retVal;
} /* end CopySidEx */
/***/
/******************************************************************************/
/* Function : FreeSidEx */
/* Purpose : Deallocates SID which was allocated by the 'CopySidEx' */
/* function */
/******************************************************************************/
/***/
void FreeSidEx ( PSID pSID ) {
HeapFree ( hHeap, 0, pSID );
} /* end FreeSidEx */
/***/
/******************************************************************************/
/* Function : AllocGroupSid */
/* Purpose : Allocates a structure which holds SIDs of groups which are */
/* not predefined. These SIDs is taking from the DACL of the */
/* specified security descriptor */
/* Returns : Pointer the allocated structure on success, */
/* NULL otherwise */
/* Warning : Allocated structure must be deallocated by 'FreeGroupSid' */
/* function */
/******************************************************************************/
/***/
PGROUP_SID AllocGroupSid ( PSECURITY_DESCRIPTOR pSD ) {
int i;
PGROUP_SID retVal = NULL;
PSID* pSID = NULL;
DWORD dwLen;
DWORD dwCount = 0;
LPVOID pACE;
PACL pACL;
PSID pSIDowner;
PSID pSIDadmin;
PSID pSIDworld;
BOOL fPresent;
BOOL fDefaulted;
if ( GetSecurityDescriptorDacl ( pSD, &fPresent, &pACL, &fDefaulted ) &&
fPresent &&
GetSecurityDescriptorOwner ( pSD, &pSIDowner, &fDefaulted ) &&
pSIDowner != NULL &&
( retVal = ( PGROUP_SID )HeapAlloc ( hHeap, 0, sizeof ( GROUP_SID ) ) ) !=
NULL
) {
pSIDadmin = AdminSid ();
pSIDworld = WorldSid ();
for ( i = 0; i < ( int )pACL -> AceCount; ++i )
if ( GetAce ( pACL, i, &pACE ) &&
!EqualSid ( pSIDadmin, GET_SID( pACE ) ) &&
!EqualSid ( pSIDworld, GET_SID( pACE ) ) &&
!EqualSid ( pSIDowner, GET_SID( pACE ) ) )
++dwCount;
pSID = ( PSID* )HeapAlloc ( hHeap, 0, dwCount * sizeof ( PSID ) );
dwCount = 0;
if ( pSID != NULL ) {
for ( i = 0; i < ( int )pACL -> AceCount; ++i )
if ( GetAce ( pACL, i, &pACE ) &&
!EqualSid ( pSIDadmin, GET_SID( pACE ) ) &&
!EqualSid ( pSIDworld, GET_SID( pACE ) ) &&
!EqualSid ( pSIDowner, GET_SID( pACE ) )
) {
pSID[ dwCount ] = ( PSID )HeapAlloc (
hHeap, 0, dwLen = GetLengthSid ( GET_SID( pACE ) )
);
if ( pSID[ dwCount ] != NULL )
CopySid ( dwLen, pSID[ dwCount++ ], GET_SID( pACE ) );
} /* end if */
} /* end if */
retVal -> nCount = dwCount;
retVal -> pSID = pSID;
} /* end if */
return retVal;
} /* end AllocGroupSid */
/***/
/******************************************************************************/
/* Function : FreeGroupSid */
/* Purpose : Deallocates a structure which was allocated by the */
/* 'AllocGroupSid' function */
/******************************************************************************/
/***/
void FreeGroupSid ( PGROUP_SID pGSID ) {
int i;
for ( i = 0; i < ( int )pGSID -> nCount; ++i )
HeapFree ( hHeap, 0, pGSID -> pSID[ i ] );
HeapFree ( hHeap, 0, pGSID -> pSID );
HeapFree ( hHeap, 0, pGSID );
} /* end FreeGroupSid */
/***/
/******************************************************************************/
/* Function : AllocAccessAllowedAce */
/* Purpose : Allocates and initializes access-control entry */

View File

@@ -45,8 +45,6 @@ extern "C" {
enum DIR_RESPONSE { DIR_ABORT, DIR_RETRY, DIR_IGNORE };
enum MB_ITEMTYPE { MBT_BUTTON, MBT_ICON };
#define FLAG_READ_PIPE 0x00000001
#define FLAG_EOF 0x00000002
#define FLAG_FILE 0x00000004
@@ -64,22 +62,6 @@ enum MB_ITEMTYPE { MBT_BUTTON, MBT_ICON };
#define LODWORD( a ) ( DWORD )( ( ( _int64 )( a ) ) & 0x00000000FFFFFFFF )
#define HIDWORD( a ) ( DWORD )( ( ( _int64 )( a ) ) >> 32 )
typedef struct _group_sid {
DWORD nCount;
PSID* pSID;
} GROUP_SID, *PGROUP_SID;
typedef struct _MB_DESC {
MB_ITEMTYPE itemType;
int itemId;
char* buttonLabel;
} MB_DESC, *LPMB_DESC;
typedef struct _file_ace {
ACE_HEADER header;
@@ -114,13 +96,6 @@ void OSDAPI FreeTokenInformation ( LPVOID );
PSECURITY_DESCRIPTOR OSDAPI GetFileSecurityEx ( LPCWSTR, SECURITY_INFORMATION );
void OSDAPI FreeFileSecurity ( PSECURITY_DESCRIPTOR );
BOOL OSDAPI LookupAccountSidEx ( PSID, LPWSTR*, LPWSTR* );
void OSDAPI FreeAccountNames ( LPWSTR, LPWSTR );
PSID OSDAPI GetSecurityDescriptorOwnerEx ( PSECURITY_DESCRIPTOR );
PSID OSDAPI GetSecurityDescriptorGroupEx ( PSECURITY_DESCRIPTOR );
PACL OSDAPI GetSecurityDescriptorDaclEx ( PSECURITY_DESCRIPTOR );
PACL OSDAPI CreateAcl ( DWORD );
void OSDAPI FreeAcl ( PACL );
@@ -137,12 +112,6 @@ PSID OSDAPI CreatorOwnerSid ( void );
PSID OSDAPI NullSid ( void );
PSID OSDAPI NtSid ( void );
PSID OSDAPI CopySidEx ( PSID );
void OSDAPI FreeSidEx ( PSID );
PGROUP_SID OSDAPI AllocGroupSid ( PSECURITY_DESCRIPTOR );
void OSDAPI FreeGroupSid ( PGROUP_SID );
PVOID OSDAPI AllocAccessAllowedAce ( DWORD, BYTE, PSID );
void OSDAPI FreeAce ( PVOID );