1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
29 #include <Standard_ProgramError.hxx>
30 #include <OSD_OSDError.hxx>
31 #include <Standard_NullObject.hxx>
32 #include <OSD_WhoAmI.hxx>
33 #include <OSD_FileNode.ixx>
35 #if!defined(TM_IN_SYS_TIME) && defined(HAVE_TIME_H)
38 # include <sys/time.h>
41 #ifdef HAVE_SYS_TYPES_H
42 # include <sys/types.h>
45 #ifdef HAVE_SYS_STAT_H
46 # include <sys/stat.h> // for "stat"
49 #include <stdlib.h> // For "system"
64 const OSD_WhoAmI Iam = OSD_WFileNode;
67 // Create a file/directory object
69 OSD_FileNode::OSD_FileNode (){
75 // Create and initialize a file/directory object
77 OSD_FileNode::OSD_FileNode (const OSD_Path& Name){
83 // Get values of object
85 void OSD_FileNode::Path (OSD_Path& Name)const{
92 // Set values of object
94 void OSD_FileNode::SetPath (const OSD_Path& Name){
102 // Test if specified file/directory exists
104 Standard_Boolean OSD_FileNode::Exists(){
108 // if (myPath.Name().Length()==0) A directory can have a null name field (ex: root)
109 // OSD_OSDError::Raise("OSD_FileNode::Exists : no name was given"); (LD)
111 // if (Failed()) Perror();
113 TCollection_AsciiString aBuffer;
114 myPath.SystemName ( aBuffer );
115 status = access ( aBuffer.ToCString() , F_OK );
117 if (status == 0) return (Standard_True);
118 else return ( Standard_False );
124 // Physically remove a file/directory
126 void OSD_FileNode::Remove(){
128 // if (myPath.Name().Length()==0) A directory can have a null name field (ex: root)
129 // OSD_OSDError::Raise("OSD_FileNode::Remove : no name was given"); (LD)
131 // if (Failed()) Perror();
133 TCollection_AsciiString aBuffer;
134 myPath.SystemName ( aBuffer );
136 if(access(aBuffer.ToCString(), W_OK))
138 myError.SetValue (errno, Iam, "Remove");
142 struct stat stat_buf;
144 if(stat(aBuffer.ToCString(), &stat_buf))
146 myError.SetValue (errno, Iam, "Remove");
150 if ( S_ISDIR(stat_buf.st_mode)) {
153 if(rmdir(aBuffer.ToCString()))
155 myError.SetValue (errno, Iam, "Remove");
161 else if ( S_ISREG(stat_buf.st_mode) || S_ISLNK(stat_buf.st_mode) ||
162 S_ISFIFO(stat_buf.st_mode) ) {
164 if (unlink ( aBuffer.ToCString()) == -1)
165 myError.SetValue (errno, Iam, "Remove");
168 myError.SetValue (EINVAL, Iam, "Remove");
175 // Move a file/directory to another path
177 void OSD_FileNode::Move(const OSD_Path& NewPath){
179 TCollection_AsciiString thisPath;
181 // if (myPath.Name().Length()==0)
182 // OSD_OSDError::Raise("OSD_FileNode::Move : no name was given");
184 // if (Failed()) Perror();
186 NewPath.SystemName( thisPath ); // Get internal path name
187 TCollection_AsciiString aBuffer;
188 myPath.SystemName ( aBuffer );
189 status = rename (aBuffer.ToCString(), thisPath.ToCString());
191 if (status == -1) myError.SetValue (errno, Iam, "Move");
198 // Copy a file to another path and name
203 int static copy_file( const char* src, const char* trg )
207 int fds = open( src, O_RDONLY );
211 int fdo = open( trg, O_WRONLY|O_TRUNC| O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
219 const int BUFSIZE=4096;
222 while ( ( n = read ( fds, buf, BUFSIZE )) >0 )
224 if ( write ( fdo, buf, n ) != n ) { // writing error
244 void OSD_FileNode::Copy(const OSD_Path& ToPath)
247 TCollection_AsciiString second_name;
249 // if (myPath.Name().Length()==0) Copy .login would raise !!
250 // OSD_OSDError::Raise("OSD_FileNode::Copy : no name was given");
251 // if (Failed()) Perror();
253 ToPath.SystemName (second_name);
255 TCollection_AsciiString aBuffer;
256 myPath.SystemName ( aBuffer );
257 status = copy_file(aBuffer.ToCString(), second_name.ToCString());
258 if (status != 0) myError.SetValue (-1, Iam, "Copy failed") ;// (LD)
260 printf("Status %d : errno # %d\n",status,errno);
268 // Get protections of a file/directory
270 OSD_Protection OSD_FileNode::Protection(){
271 OSD_Protection thisProt;
276 // if (myPath.Name().Length()==0)
277 // OSD_OSDError::Raise("OSD_FileNode::Protection : no name was given");
279 // if (Failed()) Perror();
281 TCollection_AsciiString aBuffer;
282 myPath.SystemName ( aBuffer );
283 status = stat(aBuffer.ToCString(), &myStat);
284 if (status == -1) myError.SetValue (errno, Iam, "Protection");
286 u = g = w = OSD_None;
288 if (myStat.st_mode & S_IRUSR) u |= OSD_R;
289 if (myStat.st_mode & S_IWUSR) u |= OSD_W;
290 if (myStat.st_mode & S_IXUSR) u |= OSD_X;
292 if (myStat.st_mode & S_IRGRP) g |= OSD_R;
293 if (myStat.st_mode & S_IWGRP) g |= OSD_W;
294 if (myStat.st_mode & S_IXGRP) g |= OSD_X;
296 if (myStat.st_mode & S_IROTH) w |= OSD_R;
297 if (myStat.st_mode & S_IWOTH) w |= OSD_W;
298 if (myStat.st_mode & S_IXOTH) w |= OSD_X;
301 thisProt.SetValues ((OSD_SingleProtection)s,
302 (OSD_SingleProtection)u,
303 (OSD_SingleProtection)g,
304 (OSD_SingleProtection)w);
310 // Set protections of a file/directory
312 void OSD_FileNode::SetProtection(const OSD_Protection& Prot){
315 // if (myPath.Name().Length()==0)
316 // OSD_OSDError::Raise("OSD_FileNode::SetProtection : no name was given");
318 // if (Failed()) Perror();
320 TCollection_AsciiString aBuffer;
321 myPath.SystemName ( aBuffer );
322 status = chmod (aBuffer.ToCString(), (mode_t)Prot.Internal() );
323 if (status == -1) myError.SetValue (errno, Iam, "SetProtection");
330 Standard_Integer OSD_FileNode::UserId(){
333 // if (myPath.Name().Length()==0)
334 // OSD_OSDError::Raise("OSD_FileNode::UserId : no name was given");
336 // if (Failed()) Perror();
338 /* Get File Informations */
340 TCollection_AsciiString aBuffer;
341 myPath.SystemName ( aBuffer );
342 stat ( aBuffer.ToCString(), &buffer );
344 return ( buffer.st_uid );
350 Standard_Integer OSD_FileNode::GroupId(){
353 // if (myPath.Name().Length()==0)
354 // OSD_OSDError::Raise("OSD_FileNode::GroupId : no name was given");
356 // if (Failed()) Perror();
358 /* Get File Informations */
360 TCollection_AsciiString aBuffer;
361 myPath.SystemName ( aBuffer );
362 stat ( aBuffer.ToCString(), &buffer );
364 return ( buffer.st_gid );
370 // return the date of last access of file/directory
372 Quantity_Date OSD_FileNode::CreationMoment(){
374 Quantity_Date result;
378 // if (myPath.Name().Length()==0)
379 // OSD_OSDError::Raise("OSD_FileNode::CreationMoment : no name was given");
381 // if (Failed()) Perror();
383 /* Get File Informations */
385 TCollection_AsciiString aBuffer;
386 myPath.SystemName ( aBuffer );
387 if (!stat ( aBuffer.ToCString(), &buffer )) {
388 decode = localtime(&buffer.st_ctime);
390 decode->tm_mon+1, decode->tm_mday, decode->tm_year+1900,
391 decode->tm_hour, decode->tm_min, decode->tm_sec , 0,0);
394 result.SetValues (1, 1, 1979, 0, 0, 0, 0, 0) ;
398 // return Last access of file/directory
400 Quantity_Date OSD_FileNode::AccessMoment(){
402 Quantity_Date result;
406 // if (myPath.Name().Length()==0)
407 // OSD_OSDError::Raise("OSD_FileNode::AccessMoment : no name was given");
409 // if (Failed()) Perror();
411 /* Get File Informations */
413 TCollection_AsciiString aBuffer;
414 myPath.SystemName ( aBuffer );
415 if (!stat ( aBuffer.ToCString(), &buffer )) {
416 decode = localtime(&buffer.st_atime);
418 decode->tm_mon+1, decode->tm_mday, decode->tm_year+1900,
419 decode->tm_hour, decode->tm_min, decode->tm_sec, 0,0 );
422 result.SetValues (1, 1, 1979, 0, 0, 0, 0, 0) ;
427 void OSD_FileNode::Reset(){
431 Standard_Boolean OSD_FileNode::Failed()const{
432 return( myError.Failed());
435 void OSD_FileNode::Perror() {
440 Standard_Integer OSD_FileNode::Error()const{
441 return( myError.Error());
446 //----------------------------------------------------------------------------
447 //------------------- WNT Sources of OSD_FileNode ---------------------------
448 //----------------------------------------------------------------------------
451 #include <OSD_FileNode.hxx>
452 #include <OSD_Protection.hxx>
453 #include <Quantity_Date.hxx>
454 #include <Standard_ProgramError.hxx>
456 #include <OSD_WNT_1.hxx>
462 #define TEST_RAISE( arg ) _test_raise ( fName, ( arg ) )
463 #define RAISE( arg ) Standard_ProgramError :: Raise ( ( arg ) )
465 PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( const OSD_Protection&, BOOL, char* = NULL );
466 BOOL __fastcall _osd_wnt_sd_to_protection (
467 PSECURITY_DESCRIPTOR pSD, OSD_Protection& prot, BOOL
469 Standard_Integer __fastcall _get_file_type ( Standard_CString, Standard_Integer );
471 void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
473 static BOOL __fastcall _get_file_time ( Standard_CString, LPSYSTEMTIME, BOOL );
474 static void __fastcall _test_raise ( TCollection_AsciiString, Standard_CString );
476 //=======================================================================
477 //function : OSD_FileNode
478 //purpose : Empty Constructor
479 //=======================================================================
481 OSD_FileNode::OSD_FileNode () {
483 myFileChannel = ( Standard_Integer )INVALID_HANDLE_VALUE;
485 } // end constructor ( 1 )
487 //=======================================================================
488 //function : OSD_FileNode
489 //purpose : Constructor
490 //=======================================================================
492 OSD_FileNode::OSD_FileNode ( const OSD_Path& Name ) {
494 myFileChannel = ( Standard_Integer )INVALID_HANDLE_VALUE;
497 } // end constructor ( 2 )
499 //=======================================================================
502 //=======================================================================
504 void OSD_FileNode::Path ( OSD_Path& Name ) const {
508 } // end OSD_FileNode :: Path
510 //=======================================================================
513 //=======================================================================
515 void OSD_FileNode::SetPath ( const OSD_Path& Name ) {
519 } // end OSD_FileNode :: SetPath
521 //=======================================================================
524 //=======================================================================
526 Standard_Boolean OSD_FileNode::Exists () {
528 Standard_Boolean retVal = Standard_False;;
529 TCollection_AsciiString fName;
531 myPath.SystemName ( fName );
533 if ( fName.IsEmpty () ) return Standard_False;
534 TEST_RAISE( TEXT( "Exists" ) );
536 if ( GetFileAttributes ( fName.ToCString () ) == 0xFFFFFFFF ) {
538 if ( GetLastError () != ERROR_FILE_NOT_FOUND )
540 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
544 retVal = Standard_True;
548 } // end OSD_FileNode :: Exists
550 //=======================================================================
553 //=======================================================================
555 void OSD_FileNode::Remove () {
557 TCollection_AsciiString fName;
559 myPath.SystemName ( fName );
561 TEST_RAISE( TEXT( "Remove" ) );
563 switch ( _get_file_type ( fName.ToCString (),
564 ( Standard_Integer )INVALID_HANDLE_VALUE ) ) {
568 if ( !DeleteFile ( fName.ToCString () ) )
570 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
577 // LD : Suppression de l'appel a DeleteDirectory pour
578 // ne pas detruire un repertoire no vide.
580 if ( !RemoveDirectory ( fName.ToCString () ) )
582 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
588 RAISE( TEXT( "OSD_FileNode :: Remove ():"
589 " invalid file type - neither file nor directory" ) );
593 } // end OSD_FileNode :: Remove
595 //=======================================================================
598 //=======================================================================
600 void OSD_FileNode::Move ( const OSD_Path& NewPath ) {
602 TCollection_AsciiString fName;
603 TCollection_AsciiString fNameDst;
605 myPath.SystemName ( fName );
607 TEST_RAISE( TEXT( "Move" ) );
609 NewPath.SystemName ( fNameDst );
611 switch ( _get_file_type ( fName.ToCString (),
612 ( Standard_Integer )INVALID_HANDLE_VALUE ) ) {
616 if (!MoveFileEx (fName.ToCString (), fNameDst.ToCString (),
617 MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED
621 _osd_wnt_set_error ( myError, OSD_WFileNode,
622 fName.ToCString (), fNameDst.ToCString () );
627 if ( !MoveDirectory (
628 fName.ToCString (), fNameDst.ToCString ()
632 _osd_wnt_set_error ( myError, OSD_WFileNode,
633 fName.ToCString (), fNameDst.ToCString () );
639 RAISE( TEXT( "OSD_FileNode :: Move (): "
640 "invalid file type - neither file nor directory" ) );
644 } // end OSD_FileNode :: Move
646 //=======================================================================
649 //=======================================================================
651 void OSD_FileNode::Copy ( const OSD_Path& ToPath ) {
653 TCollection_AsciiString fName;
654 TCollection_AsciiString fNameDst;
656 myPath.SystemName ( fName );
658 TEST_RAISE( TEXT( "Copy" ) );
660 ToPath.SystemName ( fNameDst );
662 switch ( _get_file_type ( fName.ToCString (),
663 ( Standard_Integer )INVALID_HANDLE_VALUE ) ) {
667 if (!CopyFile (fName.ToCString (), fNameDst.ToCString (), FALSE ))
668 _osd_wnt_set_error (myError, OSD_WFileNode,
669 fName.ToCString (), fNameDst.ToCString ());
674 if ( !CopyDirectory (
675 fName.ToCString (), fNameDst.ToCString ()
680 myError, OSD_WFileNode, fName.ToCString (), fNameDst.ToCString ()
687 RAISE( TEXT( "OSD_FileNode :: Copy ():"
688 " invalid file type - neither file nor directory" ) );
692 } // end OSD_FileNode :: Copy
694 //=======================================================================
695 //function : Protection
697 //=======================================================================
699 OSD_Protection OSD_FileNode::Protection () {
701 OSD_Protection retVal;
702 TCollection_AsciiString fName;
703 PSECURITY_DESCRIPTOR pSD;
705 myPath.SystemName ( fName );
707 TEST_RAISE( TEXT( "Protection" ) );
709 if ( ( pSD = GetFileSecurityEx (
710 fName.ToCString (), DACL_SECURITY_INFORMATION |
711 OWNER_SECURITY_INFORMATION
714 !_osd_wnt_sd_to_protection (
716 _get_file_type ( fName.ToCString (), ( Standard_Integer )INVALID_HANDLE_VALUE ) ==
721 _osd_wnt_set_error ( myError, OSD_WFileNode );
725 FreeFileSecurity ( pSD );
729 } // end OSD_FileNode :: Protection
731 //=======================================================================
732 //function : SetProtection
734 //=======================================================================
736 void OSD_FileNode::SetProtection ( const OSD_Protection& Prot ) {
738 TCollection_AsciiString fName;
739 PSECURITY_DESCRIPTOR pSD;
741 myPath.SystemName ( fName );
743 TEST_RAISE( TEXT( "SetProtection" ) );
745 pSD = _osd_wnt_protection_to_sd (
747 _get_file_type ( fName.ToCString (),
748 ( Standard_Integer )INVALID_HANDLE_VALUE ) ==
750 (char *)fName.ToCString ()
753 if ( pSD == NULL || !SetFileSecurity (
754 fName.ToCString (), DACL_SECURITY_INFORMATION, pSD
758 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
764 } // end OSD_FileNode :: SetProtection
766 //=======================================================================
767 //function : AccessMoment
769 //=======================================================================
771 Quantity_Date OSD_FileNode::AccessMoment () {
773 Quantity_Date retVal;
774 SYSTEMTIME stAccessMoment;
775 SYSTEMTIME stAccessSystemMoment;
776 TCollection_AsciiString fName;
778 myPath.SystemName ( fName );
780 TEST_RAISE( TEXT( "AccessMoment" ) );
782 // if ( _get_file_time ( fName.ToCString (), &stAccessMoment, TRUE ) )
783 if ( _get_file_time ( fName.ToCString (), &stAccessSystemMoment, TRUE ) )
786 SYSTEMTIME * aSysTime = &stAccessMoment;
787 BOOL aFlag = SystemTimeToTzSpecificLocalTime (NULL ,
788 &stAccessSystemMoment ,
790 if (aFlag == 0) // AGV: test for success (e.g., unsupported on Win95/98)
791 aSysTime = &stAccessSystemMoment;
792 retVal.SetValues (aSysTime->wMonth, aSysTime->wDay,
793 aSysTime->wYear, aSysTime->wHour,
794 aSysTime->wMinute, aSysTime->wSecond,
795 aSysTime->wMilliseconds
800 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
804 } // end OSD_FileNode :: AccessMoment
806 //=======================================================================
807 //function : CreationMoment
809 //=======================================================================
811 Quantity_Date OSD_FileNode::CreationMoment () {
813 Quantity_Date retVal;
814 SYSTEMTIME stCreationMoment;
815 SYSTEMTIME stCreationSystemMoment;
816 TCollection_AsciiString fName;
818 myPath.SystemName ( fName );
820 TEST_RAISE( TEXT( "CreationMoment" ) );
822 // if ( _get_file_time ( fName.ToCString (), &stCreationMoment, FALSE ) )
823 if ( _get_file_time ( fName.ToCString (), &stCreationSystemMoment, TRUE ) )
826 SYSTEMTIME * aSysTime = &stCreationMoment;
827 BOOL aFlag = SystemTimeToTzSpecificLocalTime (NULL,
828 &stCreationSystemMoment ,
830 if (aFlag == 0) // AGV: test for success (e.g., unsupported on Win95/98)
831 aSysTime = &stCreationSystemMoment;
832 retVal.SetValues (aSysTime->wMonth, aSysTime->wDay,
833 aSysTime->wYear, aSysTime->wHour,
834 aSysTime->wMinute, aSysTime->wSecond,
835 aSysTime->wMilliseconds
840 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
844 } // end OSD_FileNode :: CreationMoment
846 //=======================================================================
849 //=======================================================================
851 Standard_Integer OSD_FileNode::UserId () {
853 PSID pSIDowner = NULL;
856 TCollection_AsciiString fName;
857 PSECURITY_DESCRIPTOR pSD;
859 myPath.SystemName ( fName );
861 TEST_RAISE( TEXT( "UserId" ) );
863 if ( ( pSD = GetFileSecurityEx (
865 OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION
868 GetSecurityDescriptorOwner ( pSD, &pSIDowner, &fDefaulted ) &&
872 retVal = CopySidEx ( pSIDowner );
876 _osd_wnt_set_error ( myError, OSD_WFileNode );
880 FreeFileSecurity ( pSD );
882 return ( Standard_Integer )retVal;
884 } // end OSD_FileNode :: UserId
886 //=======================================================================
889 //=======================================================================
891 Standard_Integer OSD_FileNode::GroupId () {
893 PGROUP_SID retVal = NULL;
894 TCollection_AsciiString fName;
895 PSECURITY_DESCRIPTOR pSD;
897 myPath.SystemName ( fName );
899 TEST_RAISE( TEXT( "GroupId" ) );
901 if ( ( pSD = GetFileSecurityEx (
903 OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION
908 retVal = AllocGroupSid ( pSD );
909 FreeFileSecurity ( pSD );
913 _osd_wnt_set_error ( myError, OSD_WFileNode );
915 return ( Standard_Integer )retVal;
917 } // end OSD_FileNode :: GroupId
919 //=======================================================================
922 //=======================================================================
924 Standard_Boolean OSD_FileNode::Failed () const {
926 return myError.Failed ();
928 } // end OSD_FileNode :: Failed
930 //=======================================================================
933 //=======================================================================
935 void OSD_FileNode::Reset () {
939 } // end OSD_FileNode :: Reset
941 //=======================================================================
944 //=======================================================================
946 void OSD_FileNode::Perror () {
950 } // end OSD_FileNode :: Perror
952 //=======================================================================
955 //=======================================================================
957 Standard_Integer OSD_FileNode::Error () const {
959 return myError.Error ();
961 } // end OSD_FileNode :: Error
963 void _osd_wnt_set_error ( OSD_Error& err, OSD_WhoAmI who, ... ) {
966 Standard_Character buffer[ 2048 ];
969 va_start ( arg_ptr, err );
971 errCode = GetLastError ();
973 if ( !FormatMessage (
974 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY,
975 0, errCode, MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ),
976 buffer, 2048, &arg_ptr
980 sprintf ( buffer, "error code %d", (Standard_Integer)errCode );
981 SetLastError ( errCode );
985 err.SetValue ( errCode, who, buffer );
991 #if defined(__CYGWIN32__) || defined(__MINGW32__)
994 #define __leave return retVal
997 static BOOL __fastcall _get_file_time (
998 Standard_CString fName, LPSYSTEMTIME lpSysTime, BOOL fAccess
1001 BOOL retVal = FALSE;
1002 FILETIME ftCreationTime;
1003 FILETIME ftLastWriteTime;
1005 HANDLE hFile = INVALID_HANDLE_VALUE;
1009 if ( ( hFile = CreateFile (
1010 fName, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL
1012 ) == INVALID_HANDLE_VALUE
1015 if ( !GetFileTime ( hFile, &ftCreationTime, NULL, &ftLastWriteTime ) ) __leave;
1017 lpftPtr = fAccess ? &ftLastWriteTime : &ftCreationTime;
1019 if ( !FileTimeToSystemTime ( lpftPtr, lpSysTime ) ) __leave;
1027 if ( hFile != INVALID_HANDLE_VALUE )
1029 CloseHandle ( hFile );
1034 leave: ; // added for VisualAge
1039 } // end _get_file_time
1041 #if defined(__CYGWIN32__) || defined(__MINGW32__)
1047 static void __fastcall _test_raise ( TCollection_AsciiString fName, Standard_CString str ) {
1049 Standard_Character buff[ 64 ];
1051 if ( fName.IsEmpty () ) {
1053 _tcscpy ( buff, TEXT( "OSD_FileNode :: " ) );
1054 _tcscat ( buff, str );
1055 _tcscat ( buff, TEXT( " (): wrong access" ) );
1057 Standard_ProgramError :: Raise ( buff );
1061 } // end _test_raise