1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0023672: Eliminate obsolete functions in OSD_WNT_1.cxx

MsgBox() and several other obsolete Windows-specific functions eliminated in OSD_WNT*
This commit is contained in:
abv 2012-12-25 23:32:01 +04:00
parent 8f9a9b9d10
commit b2d3f23104
6 changed files with 21 additions and 785 deletions

View File

@ -8,7 +8,6 @@ OSD_Getkey.c
OSD_Function.hxx
OSD_ErrorList.hxx
OSD_WNT.cxx
OSD_WNT_1.cxx
OSD_WNT.hxx
OSD_WNT_1.hxx
OSD_WNT_BREAK.hxx

View File

@ -48,7 +48,6 @@ static BOOL fInit = FALSE;
static PSID* predefinedSIDs;
static HANDLE hHeap;
/***/
static DELETE_DIR_PROC _delete_dir_proc;
static MOVE_DIR_PROC _move_dir_proc;
static COPY_DIR_PROC _copy_dir_proc;
static RESPONSE_DIR_PROC _response_dir_proc;
@ -895,152 +894,6 @@ void FreeAce ( PVOID pACE ) {
#define WILD_CARD TEXT( "/*.*" )
#define WILD_CARD_LEN ( sizeof ( WILD_CARD ) )
/* LD : We do not need this routine any longer : */
/* Dont remove a no empty directory */
#if 0
/***/
/******************************************************************************/
/* Function : DeleteDirectory */
/* Purpose : Deletes specified directory tree */
/* Returns : TRUE on success, FALSE otherwise */
/******************************************************************************/
/***/
BOOL DeleteDirectory ( LPCTSTR dirName ) {
PWIN32_FIND_DATA pFD;
LPTSTR pName = NULL;
LPTSTR pFullName = NULL;
HANDLE hFindFile = INVALID_HANDLE_VALUE;
BOOL fFind;
BOOL retVal = FALSE;
DIR_RESPONSE response;
if ( ( pFD = ( PWIN32_FIND_DATA )HeapAlloc (
hHeap, 0, sizeof ( WIN32_FIND_DATA )
)
) != NULL &&
( pName = ( LPTSTR )HeapAlloc (
hHeap, 0, lstrlen ( dirName ) + WILD_CARD_LEN +
sizeof ( TEXT( '\x00' ) )
)
) != NULL
) {
lstrcpy ( pName, dirName );
lstrcat ( pName, WILD_CARD );
retVal = TRUE;
fFind = ( hFindFile = FindFirstFile ( pName, pFD ) ) != INVALID_HANDLE_VALUE;
while ( fFind ) {
if ( pFD -> cFileName[ 0 ] != TEXT( '.' ) ||
pFD -> cFileName[ 0 ] != TEXT( '.' ) &&
pFD -> cFileName[ 1 ] != TEXT( '.' )
) {
if ( ( pFullName = ( LPTSTR )HeapAlloc (
hHeap, 0,
lstrlen ( dirName ) + lstrlen ( pFD -> cFileName ) +
sizeof ( TEXT( '/' ) ) + sizeof ( TEXT( '\x00' ) )
)
) == NULL
) break;
lstrcpy ( pFullName, dirName );
lstrcat ( pFullName, TEXT( "/" ) );
lstrcat ( pFullName, pFD -> cFileName );
if ( pFD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {
if ( !( retVal = DeleteDirectory ( pFullName ) ) )
break;
} else {
retry:
if ( !( retVal = DeleteFile ( pFullName ) ) ) {
if ( _response_dir_proc != NULL ) {
response = ( *_response_dir_proc ) ( pFullName );
if ( response == DIR_ABORT )
break;
else if ( response == DIR_RETRY )
goto retry;
else if ( response == DIR_IGNORE )
retVal = TRUE;
else
break;
} /* end if */
} else if ( _delete_dir_proc != NULL )
( *_delete_dir_proc ) ( pFullName );
} /* end else */
HeapFree ( hHeap, 0, pFullName );
pFullName = NULL;
} /* end if */
fFind = FindNextFile ( hFindFile, pFD );
} /* end while */
} /* end if */
if ( hFindFile != INVALID_HANDLE_VALUE ) FindClose ( hFindFile );
if ( pFullName != NULL ) HeapFree ( hHeap, 0, pFullName );
if ( pName != NULL ) HeapFree ( hHeap, 0, pName );
if ( pFD != NULL ) HeapFree ( hHeap, 0, pFD );
if ( retVal ) {
retry_1:
retVal = RemoveDirectory ( dirName );
if ( !retVal ) {
if ( _response_dir_proc != NULL ) {
response = ( *_response_dir_proc ) ( pFullName );
if ( response == DIR_RETRY )
goto retry_1;
else if ( response == DIR_IGNORE )
retVal = TRUE;
} /* end if */
} else if ( _delete_dir_proc != NULL )
( *_delete_dir_proc ) ( dirName );
} /* end if */
return retVal;
} /* end DeleteDirectory */
#endif
/***/
/******************************************************************************/
/* Function : MoveDirectory */
@ -1410,20 +1263,6 @@ retry:
} /* end CopyDirectory */
/***/
/******************************************************************************/
/* Function : SetDeleteDirectoryProc */
/* Purpose : Sets callback procedure which is calling by the */
/* 'DeleteDirectory' after deleteion of each item in the */
/* directory. To unregister this callback function supply NULL */
/* pointer */
/******************************************************************************/
/***/
void SetDeleteDirectoryProc ( DELETE_DIR_PROC proc ) {
_delete_dir_proc = proc;
} /* end SetDeleteDirectoryProc */
/***/
/******************************************************************************/
/* Function : SetMoveDirectoryProc */
/* Purpose : Sets callback procedure which is calling by the */
/* 'MoveDirectory' after moving of each item in the */

View File

@ -1,568 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifdef WNT
#include <OSD_WNT_1.hxx>
#include <windowsx.h>
static FILETIME ftKernelTimeStart, ftUserTimeStart, ftElapsedStart;
static TCHAR timeBuffer[ 80 ];
static __int64 __fastcall FileTimeToQuadWord ( PFILETIME );
static void __fastcall QuadWordToFileTime ( __int64, PFILETIME );
BOOL OSDAPI DirWalk (
LPCTSTR dirName, LPCTSTR wildCard, BOOL ( *func ) ( LPCTSTR, BOOL, void* ),
BOOL fRecurse, void* lpClientData
) {
int len;
PWIN32_FIND_DATA pFD;
LPTSTR pName = NULL;
LPTSTR pFullName = NULL;
LPTSTR pTmp;
HANDLE hFindFile = INVALID_HANDLE_VALUE;
BOOL fFind;
BOOL retVal = TRUE;
HANDLE hHeap = GetProcessHeap ();
if ( ( pFD = ( PWIN32_FIND_DATA )HeapAlloc (
hHeap, 0, sizeof ( WIN32_FIND_DATA )
)
) != NULL &&
( pName = ( LPTSTR )HeapAlloc (
hHeap, 0, lstrlen ( dirName ) +
lstrlen ( wildCard ) + sizeof ( TEXT( '\x00' ) )
)
) != NULL
) {
lstrcpy ( pName, dirName );
lstrcat ( pName, wildCard );
fFind = ( hFindFile = FindFirstFile ( pName, pFD ) ) != INVALID_HANDLE_VALUE;
while ( fFind ) {
if ( pFD -> cFileName[ 0 ] != TEXT( '.' ) ||
pFD -> cFileName[ 0 ] != TEXT( '.' ) &&
pFD -> cFileName[ 1 ] != TEXT( '.' )
) {
if ( ( pFullName = ( LPTSTR )HeapAlloc (
hHeap, 0,
lstrlen ( dirName ) + lstrlen ( pFD -> cFileName ) +
sizeof ( TEXT( '/' ) ) +
sizeof ( TEXT( '\x00' ) )
)
) == NULL
) {
retVal = FALSE;
break;
} /* end if */
lstrcpy ( pFullName, dirName );
lstrcat ( pFullName, pFD -> cFileName );
if ( pFD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && fRecurse ) {
lstrcat ( pFullName, TEXT( "/" ) );
if ( !DirWalk ( pFullName, wildCard, func, fRecurse, lpClientData ) ) retVal = FALSE;
} else if ( !( *func ) (
pFullName, pFD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? TRUE :
FALSE,
lpClientData
)
) retVal = FALSE;
HeapFree ( hHeap, 0, pFullName );
pFullName = NULL;
} /* end if */
fFind = FindNextFile ( hFindFile, pFD );
} /* end while */
} else
retVal = FALSE;
len = 1;
if ( hFindFile != INVALID_HANDLE_VALUE ) FindClose ( hFindFile );
if ( fRecurse ) {
if ( dirName[ len = lstrlen ( dirName ) - 1 ] == TEXT( '/' ) ) {
if ( ( pTmp = ( LPTSTR )HeapAlloc ( hHeap, 0, len + 2 ) ) != NULL ) {
lstrcpy ( pTmp, dirName );
pTmp[ len ] = 0;
fFind = TRUE;
} else {
retVal = FALSE;
len = 0;
} /* end else */
} /* end if */
if ( len ) {
retVal = ( *func ) ( fFind ? pTmp : dirName, TRUE, lpClientData );
if ( fFind ) HeapFree ( hHeap, 0, pTmp );
} /* end if */
} /* end if */
if ( pFullName != NULL ) HeapFree ( hHeap, 0, pFullName );
if ( pName != NULL ) HeapFree ( hHeap, 0, pName );
if ( pFD != NULL ) HeapFree ( hHeap, 0, pFD );
return retVal;
} // end DirWalk
void WNT_InitTimer ( void ) {
FILETIME ftDummy;
SYSTEMTIME stStart;
GetProcessTimes (
GetCurrentProcess (), &ftDummy, &ftDummy, &ftKernelTimeStart, &ftUserTimeStart
);
GetSystemTime ( &stStart );
SystemTimeToFileTime ( &stStart, &ftElapsedStart );
} // end WNT_InitTimer
LPCTSTR WNT_StatTimer ( void ) {
__int64 qwKernelTimeElapsed, qwUserTimeElapsed, qwTotalTimeElapsed;
FILETIME ftKernelTimeEnd, ftUserTimeEnd, ftTotalTimeEnd, ftDummy;
SYSTEMTIME stKernel, stUser, stTotal;
GetProcessTimes (
GetCurrentProcess (), &ftDummy, &ftDummy, &ftKernelTimeEnd, &ftUserTimeEnd
);
GetSystemTime ( &stTotal );
SystemTimeToFileTime ( &stTotal, &ftTotalTimeEnd );
qwKernelTimeElapsed = FileTimeToQuadWord ( &ftKernelTimeEnd ) -
FileTimeToQuadWord ( &ftKernelTimeStart );
qwUserTimeElapsed = FileTimeToQuadWord ( &ftUserTimeEnd ) -
FileTimeToQuadWord ( &ftUserTimeStart );
qwTotalTimeElapsed = FileTimeToQuadWord ( &ftTotalTimeEnd ) -
FileTimeToQuadWord ( &ftElapsedStart );
QuadWordToFileTime ( qwKernelTimeElapsed, &ftKernelTimeEnd );
QuadWordToFileTime ( qwUserTimeElapsed, &ftUserTimeEnd );
QuadWordToFileTime ( qwTotalTimeElapsed, &ftTotalTimeEnd );
FileTimeToSystemTime ( &ftKernelTimeEnd, &stKernel );
FileTimeToSystemTime ( &ftUserTimeEnd, &stUser );
FileTimeToSystemTime ( &ftTotalTimeEnd, &stTotal );
wsprintf (
timeBuffer,
TEXT( "Kernel=%02d:%02d:%02d:%03d User=%02d:%02d:%02d:%03d Elapsed=%02d:%02d:%02d:%03d" ),
stKernel.wHour, stKernel.wMinute, stKernel.wSecond, stKernel.wMilliseconds,
stUser.wHour, stUser.wMinute, stUser.wSecond, stUser.wMilliseconds,
stTotal.wHour, stTotal.wMinute, stTotal.wSecond, stTotal.wMilliseconds
);
return timeBuffer;
} // end WNT_StatTimer
static __int64 __fastcall FileTimeToQuadWord ( PFILETIME pFt ) {
__int64 qw;
qw = pFt -> dwHighDateTime;
qw <<= 32;
qw |= pFt -> dwLowDateTime;
return qw;
} // end FileTimeToQuadWord
static void __fastcall QuadWordToFileTime ( __int64 qw, PFILETIME pFt ) {
pFt -> dwHighDateTime = ( DWORD )( qw >> 32 );
pFt -> dwLowDateTime = ( DWORD ) ( qw & 0xFFFFFFFF );
} // end QuadWordToFileTime
#if defined (_UNICODE)
#define CHR_SIZE sizeof(WORD)/2
#else
#define CHR_SIZE sizeof(WORD)
#endif
////////////////////////////////////////////////////////////////
LPWORD lpwAlign (LPWORD lpIn)
{
ULONG ul;
ul = (ULONG) lpIn;
ul +=3;
ul >>=2;
ul <<=2;
return (LPWORD) ul;
}
int CopyAnsiToWideChar (LPWORD lpWCStr, LPSTR lpAnsiIn)
{
int nChar = 0;
do {
*lpWCStr++ = (WORD) *lpAnsiIn;
nChar++;
} while (*lpAnsiIn++);
return nChar;
}
LPWORD SetClassParams (LPWORD p, DWORD style, short x, short y,
short cx, short cy, WORD id, WORD classId)
{
LPWORD pp = p;
*pp++ = LOWORD (style);
*pp++ = HIWORD (style);
*pp++ = 0; // LOWORD (lExtendedStyle)
*pp++ = 0; // HIWORD (lExtendedStyle)
*pp++ = x; // x
*pp++ = y; // y
*pp++ = cx; // cx
*pp++ = cy; // cy
*pp++ = id; // id
*pp++ = 0xFFFF;
*pp++ = classId;
return pp;
}
short MapX (LONG aX) {
static LONG baseUnits = 0;
if ( !baseUnits ) {
baseUnits = GetDialogBaseUnits ();
}
return (short)(aX*4) / LOWORD (baseUnits);
}
short MapY (LONG aY) {
static LONG baseUnits = 0;
if ( !baseUnits ) {
baseUnits = GetDialogBaseUnits ();
}
return (short)(aY*8) / HIWORD (baseUnits);
}
#if defined(__CYGWIN32__) || defined(__MINGW32__)
#define __try
#define __finally
#define __leave return res
#endif
LONG GetTextParams ( HDC hdc, LPCTSTR lpText ) {
LONG res = 0;
SIZE size;
_TCHAR* dummy;
__try {
dummy = _tcsdup (lpText);
if ( !dummy ) __leave;
short txtW = 0, txtH = 0;
_TCHAR* tok = _tcstok ( dummy, TEXT( "\n" ) );
while ( tok ) {
if ( !GetTextExtentPoint32 (hdc, tok, _tcslen(tok), (LPSIZE)&size) ) __leave;
txtH += (short)size.cy;
if ( txtW < size.cx )
txtW = (short)size.cx;
tok = _tcstok ( NULL, TEXT( "\n" ) );
}
res = MAKELONG (MapX(txtW), MapY(txtH));
}
__finally {
free (dummy);
}
#ifdef VAC
leave: ; // added for VisualAge
#endif
return res;
}
#if defined(__CYGWIN32__) || defined(__MINGW32__)
#undef __try
#undef __finally
#undef __leave
#endif
/////////////////ON_COMMAND/////////////////////////////////////
void MsgBox_OnCommand (HWND hwnd, _TINT id, HWND hCtl, UINT codeNotify) {
EndDialog (hwnd, id);
}
/////////////////ON_INIT/////////////////////////////////////
BOOL MsgBox_OnInit ( HWND hwnd, HWND hwndFocus, LPARAM lParam ) {
SetForegroundWindow ( hwnd );
return TRUE;
} // end MsgBox_OnInit
/////////////////DISPATCH_MESSAGES////////////////////////////////////
BOOL CALLBACK MsgBoxProc (HWND hdlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
BOOL fProcessed = TRUE;
switch (uMsg) {
HANDLE_MSG (hdlg, WM_INITDIALOG, MsgBox_OnInit);
HANDLE_MSG (hdlg, WM_COMMAND, MsgBox_OnCommand);
// Default actions
default:
fProcessed = FALSE;
break;
}
return (fProcessed);
}
/////////////////////////////////////////////////////////////////
#if defined(__CYGWIN32__) || defined(__MINGW32__)
#define __try
#define __finally
#define __leave return -1
#endif
_TINT MsgBox ( HWND hParent,
LPTSTR lpText,
LPCTSTR lpCaption,
_TINT childCount,
LPMB_DESC lpChildren
)
{
WORD *p = NULL, *pDlgTemplate = NULL, *pX, *pY,
*pWidth, *pHeight, *pItemsCount;
int nchar;
DWORD lStyle;
_TINT scrW = 0, scrH = 0;
UINT bufSize = 0;
HDC hDisp = NULL;
short iconWidth = 0, iconHeight = 0;
short butCount = 0, butMaxWidth = 0, butMaxHeight = 0;
short butSpace = 8, butOffset = 0;
__try {
/* Get dialog base units & map it to dialog units*/
hDisp = CreateDC ( TEXT( "DISPLAY" ), NULL, NULL, NULL );
if ( !hDisp ) __leave;
scrW = GetDeviceCaps ( hDisp, HORZRES );
scrH = GetDeviceCaps ( hDisp, VERTRES );
scrW = MapX (scrW);
scrH = MapY (scrH);
LONG txtParam = GetTextParams ( hDisp, lpText );
if ( !txtParam ) __leave;
// Calculate needed size of buffer
bufSize = 14*sizeof(WORD) + _tcslen(lpCaption)*CHR_SIZE;
bufSize += 14*sizeof(WORD) + _tcslen(lpText)*CHR_SIZE;
_TINT i;
BOOL isIcon = FALSE;
for ( i=0; i<childCount; i++) {
if ( (lpChildren[i].itemType == MBT_ICON) && !isIcon ) {
isIcon = TRUE;
bufSize += 16*sizeof(WORD);
}
if ( lpChildren[i].itemType == MBT_BUTTON ) {
bufSize += ( 14*sizeof(WORD)
+_tcslen(lpChildren[i].buttonLabel)*CHR_SIZE );
}
}
pDlgTemplate = p = (PWORD) LocalAlloc (LPTR, bufSize);
if ( !pDlgTemplate ) __leave;
lStyle = DS_MODALFRAME | DS_SYSMODAL | WS_POPUP | WS_CAPTION;
*p++ = LOWORD (lStyle);
*p++ = HIWORD (lStyle);
*p++ = 0; // LOWORD (lExtendedStyle)
*p++ = 0; // HIWORD (lExtendedStyle)
pItemsCount = p;
*p++ = 0; // NumberOfItems
pX = p;
*p++ = 0; // x
pY = p;
*p++ = 0; // y
pWidth = p;
*p++ = 0; // cx
pHeight = p;
*p++ = 0; // cy
*p++ = 0; // Menu
*p++ = 0; // Class
/* copy the title of the dialog */
nchar = CopyAnsiToWideChar (p, (LPTSTR)lpCaption);
p += nchar;
/* make sure the first item starts on a DWORD boundary */
p = lpwAlign (p);
/* Add children to dialog */
// First build icon
isIcon = FALSE;
for ( i=0; i<childCount; i++) {
if ( (lpChildren[i].itemType == MBT_ICON) && !isIcon ) {
isIcon = TRUE;
p = SetClassParams ( p,
WS_CHILD | WS_VISIBLE | SS_ICON,
8, 8, 0, 0, 0, 0x0082
);
*p++ = (WORD)0xffff;
*p++ = (WORD)lpChildren[i].itemId;
*p++ = 0; // advance pointer over nExtraStuff WORD
p = lpwAlign (p);
*pItemsCount += 1;
// Icon sizes LoadIcon GetIconInfo ICONINFO
iconWidth = MapX ( GetSystemMetrics ( SM_CXICON ) );
iconHeight = MapY ( GetSystemMetrics ( SM_CYICON ) );
}
if ( lpChildren[i].itemType == MBT_BUTTON ) {
_TINT len = _tcslen (lpChildren[i].buttonLabel);
SIZE aTxtSize;
GetTextExtentPoint32 ( hDisp, lpChildren[i].buttonLabel,
len, (LPSIZE)&aTxtSize );
if ( butMaxWidth < aTxtSize.cx )
butMaxWidth = (short)aTxtSize.cx;
if ( butMaxHeight < aTxtSize.cy )
butMaxHeight = (short)aTxtSize.cy;
butCount++;
}
} // Find and add icon and calculate button sizes, etc.
// Map button sizes
butMaxWidth = MapX (butMaxWidth) + 8;
butMaxHeight = MapY (butMaxHeight) + 6;
if ( butMaxWidth < 28 ) butMaxWidth = 28;
// Update MsgBox width & height
*pWidth = iconWidth + LOWORD(txtParam) + 20;
*pHeight = max ( iconHeight, HIWORD(txtParam) ) + 20;
// Text itself
lStyle = WS_CHILD | WS_VISIBLE;
if ( *lpText == TEXT( '\x03' ) ) {
++lpText;
lStyle |= SS_CENTER;
} else
lStyle |= SS_LEFT;
p = SetClassParams ( p, lStyle,
16 + iconWidth, 8, *pWidth - 8, *pHeight, 0, 0x0082
);
nchar = CopyAnsiToWideChar (p, (LPTSTR)lpText);
p += nchar;
*p++ = 0; // advance pointer over nExtraStuff WORD
p = lpwAlign (p);
*pItemsCount += 1;
// Update width & height of a dialog
_TINT nW = (butSpace+3+butMaxWidth)*butCount;
if ( nW > *pWidth ) {
*pWidth = nW;
} else {
butOffset = (*pWidth - butCount*(butMaxWidth+butSpace) - butSpace) / 2;
}
*pHeight = *pHeight + butMaxHeight + 4;
// Update position of a dialog
*pX = ( scrW - (*pWidth) ) / 2;
*pY = ( scrH - (*pHeight) ) / 2;
// Childs ============================================================ //
short butNum = 0;
for ( i=0; i<childCount; i++) {
if ( lpChildren[i].itemType == MBT_BUTTON ) {
lStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
lStyle |= ( ( i == 0 ) ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON );
p = SetClassParams ( p,
lStyle,
8 + butOffset + butNum*(butMaxWidth+butSpace),
*pHeight - butMaxHeight - 4,
butMaxWidth, butMaxHeight, lpChildren[i].itemId, 0x0080
);
nchar = CopyAnsiToWideChar (p, (LPTSTR)lpChildren[i].buttonLabel);
p += nchar;
*p++ = 0; // advance pointer over nExtraStuff WORD
p = lpwAlign (p);
butNum++;
*pItemsCount += 1;
}
} // Childs
} // __try
/*----------------------------------------------------------------------*/
__finally {
int res = -1;
if ( pDlgTemplate )
res = DialogBoxIndirect (
GetModuleHandle(NULL),
(LPDLGTEMPLATE)pDlgTemplate,
hParent,
(DLGPROC)MsgBoxProc
);
if ( hDisp ) DeleteDC ( hDisp );
if ( pDlgTemplate ) LocalFree (LocalHandle (pDlgTemplate));
return ( res );
}
#ifdef VAC
leave: ; // added for VisualAge
#endif
}
#if defined(__CYGWIN32__) || defined(__MINGW32__)
#undef __try
#undef __finally
#undef __leave
#endif
#endif

View File

@ -154,24 +154,13 @@ void OSDAPI FreeGroupSid ( PGROUP_SID );
PVOID OSDAPI AllocAccessAllowedAce ( DWORD, BYTE, PSID );
void OSDAPI FreeAce ( PVOID );
BOOL OSDAPI DeleteDirectory ( LPCTSTR );
BOOL OSDAPI MoveDirectory ( LPCTSTR, LPCTSTR );
BOOL OSDAPI CopyDirectory ( LPCTSTR, LPCTSTR );
void OSDAPI SetDeleteDirectoryProc ( DELETE_DIR_PROC );
void OSDAPI SetMoveDirectoryProc ( MOVE_DIR_PROC );
void OSDAPI SetCopyDirectoryProc ( COPY_DIR_PROC );
void OSDAPI SetResponseDirectoryProc ( RESPONSE_DIR_PROC );
BOOL OSDAPI DirWalk ( LPCTSTR, LPCTSTR, BOOL ( * ) ( LPCTSTR, BOOL, void* ), BOOL, void* );
_TINT OSDAPI MsgBox ( HWND, LPTSTR, LPCTSTR, _TINT, LPMB_DESC );
void OSDAPI WNT_InitTimer ( void );
LPCTSTR OSDAPI WNT_StatTimer ( void );
void OSDAPI _debug_break ( LPTSTR );
# ifdef __cplusplus
}
# endif /* __cplusplus */

View File

@ -18,7 +18,7 @@
#include <OSD.ixx>
#ifdef WNT
#ifdef _WIN32
//---------------------------- Windows NT System --------------------------------
@ -70,7 +70,7 @@ static Standard_Mutex THE_SIGNAL_MUTEX;
static LONG __fastcall _osd_raise ( DWORD, LPTSTR );
static BOOL WINAPI _osd_ctrl_break_handler ( DWORD );
extern "C" Standard_EXPORT LONG _osd_debug ( void );
static LONG _osd_debug ( void );
MB_DESC fatalErrorDesc[] = {
@ -227,55 +227,32 @@ static LONG CallHandler (DWORD dwExceptionCode,
} // end switch
// provide message to the user with possibility to stop
int idx = lstrlen ( buffer );
if ( idx && fMsgBox && dwExceptionCode != EXCEPTION_NONCONTINUABLE_EXCEPTION ) {
// reset FP operations before message box, otherwise it may fail to show up
_fpreset();
_clearfp();
MessageBeep ( MB_ICONHAND );
int msgID = MsgBox ( NULL, buffer, TEXT( "Error detected" ), 4, fatalErrorDesc );
// cout << "flterr" << flterr << " fFltExceptions " << fFltExceptions << endl ;
if ( flterr ) {
if ( !fFltExceptions )
return EXCEPTION_EXECUTE_HANDLER;
_fpreset () ;
_clearfp() ;
_controlfp ( 0, _OSD_FPX ) ; // JR add :
// cout << "OSD::WntHandler _controlfp( 0, _OSD_FPX ) " << hex << _controlfp(0,0) << dec << endl ;
}
buffer[ idx ] = 0;
switch ( msgID ) {
case IDYES: {
PTCHAR ptr = _tcschr ( buffer, TEXT( '\n' ) );
if ( ptr != NULL )
*ptr = TEXT( ' ' );
// cout << "CallHandler " << dwExceptionCode << endl ;
_osd_raise ( dwExceptionCode, buffer );
} // IDYES
case IDNO:
LONG action ;
action = _osd_debug ();
// cout << "return from CallHandler -> DebugBreak " << endl ;
DebugBreak ();
_osd_raise ( dwExceptionCode, buffer );
// cout << "CallHandler return : " << action << endl ;
return action ;
case IDCANCEL:
exit ( 0xFFFF );
} // end switch
MessageBeep ( MB_ICONHAND );
int aChoice = ::MessageBox (0, buffer, "OCCT Exception Handler", MB_ABORTRETRYIGNORE | MB_ICONSTOP);
if (aChoice == IDRETRY)
{
_osd_debug();
DebugBreak();
}
else if (aChoice == IDABORT)
exit(0xFFFF);
}
else {
if ( flterr ) {
if ( !fFltExceptions )
return EXCEPTION_EXECUTE_HANDLER;
_fpreset () ;
_clearfp() ;
_controlfp ( 0, _OSD_FPX ) ; // JR add :
// reset FPE state
if ( flterr ) {
if ( !fFltExceptions )
return EXCEPTION_EXECUTE_HANDLER;
_fpreset () ;
_clearfp() ;
_controlfp ( 0, _OSD_FPX ) ; // JR add :
// cout << "OSD::WntHandler _controlfp( 0, _OSD_FPX ) " << hex << _controlfp(0,0) << dec << endl ;
}
}
return _osd_raise ( dwExceptionCode, buffer );
#else

View File

@ -27,7 +27,7 @@
#include <Aspect_Convert.hxx>
#include <stdio.h>
extern "C" void _debug_break ( char* );
//************************************************************************//
//***//
// callback function to manage window's background