2008-07-03 16:30 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)

* contrib/hbmzip/hbmzip.c
    + implemented file get attributes and file set attributes for DOS and OS2
    ; I've not even tried to compile the code. I have no required OS and 
      compile enviroment. DOS implementation is written using docs from 
      http://www.delorie.com/djgpp/doc/libc-2.02/, OS2 implementation
      is just guess... Please test, I hope adding some #include <xxx.h> 
      will make this code usable.
This commit is contained in:
Mindaugas Kavaliauskas
2008-07-03 13:34:40 +00:00
parent 40b78cae34
commit 0c4458752f
2 changed files with 123 additions and 2 deletions

View File

@@ -8,6 +8,15 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-07-03 16:30 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* contrib/hbmzip/hbmzip.c
+ implemented file get attributes and file set attributes for DOS and OS2
; I've not even tried to compile the code. I have no required OS and
compile enviroment. DOS implementation is written using docs from
http://www.delorie.com/djgpp/doc/libc-2.02/, OS2 implementation
is just guess... Please test, I hope adding some #include <xxx.h>
will make this code usable.
2008-07-03 15:15 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
- contrib/hbgd/tests/imgs_in/gdlogobig.png
- contrib/hbgd/tests/imgs_in/conv_test.jpg

View File

@@ -479,8 +479,11 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName, char*
FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY |
FILE_ATTRIBUTE_ARCHIVE );
ulExtAttr |= 0x01B60000; /* rw-rw-rw- */
if( ulExtAttr | FILE_ATTRIBUTE_READONLY )
ulExtAttr |= 0x01240000; /* r--r--r-- */
else
ulExtAttr |= 0x01B60000; /* rw-rw-rw- */
if( ulExtAttr & FILE_ATTRIBUTE_DIRECTORY )
ulExtAttr |= 0x40000000;
else
@@ -540,6 +543,87 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName, char*
else
fError = TRUE;
}
#elif defined( HB_OS_DOS )
{
int iAttr;
iAttr = _chmod( szFileName, 0, 0 );
if( iAttr != -1 )
{
ulExtAttr = iAttr & ( HB_FA_READONLY | HB_FA_HIDDEN | HB_FA_SYSTEM |
HB_FA_DIRECTORY | HB_FA_ARCHIVE );
if( ulExtAttr | FILE_ATTRIBUTE_READONLY )
ulExtAttr |= 0x01240000; /* r--r--r-- */
else
ulExtAttr |= 0x01B60000; /* rw-rw-rw- */
if( ulExtAttr & FILE_ATTRIBUTE_DIRECTORY )
ulExtAttr |= 0x40000000;
else
ulExtAttr |= 0x80000000;
ulLen = strlen( szZipName );
if( ulLen > 4 )
{
pString = &szZipName[ ulLen - 4 ];
if( hb_stricmp( pString, ".exe" ) == 0 || hb_stricmp( pString, ".com" ) == 0 ||
hb_stricmp( pString, ".bat" ) == 0 )
{
ulExtAttr |= 0x00490000; /* --x--x--x */
}
}
}
else
fError = TRUE;
}
#elif defined( HB_OS_OS2 )
{
FILESTATUS3 fs3;
APIRET ulrc;
ULONG ulAttr;
ulrc = DosQueryPathInfo( szName, FIL_STANDARD, &fs3, sizeof( fs3 ) );
if( ulrc == NO_ERROR )
{
ulAttr = 0;
if( fs3.attrFile & FILE_READONLY )
ulAttr |= FA_READONLY;
if( fs3.attrFile & FILE_HIDDEN )
ulAttr |= FA_HIDDEN;
if( fs3.attrFile & FILE_SYSTEM )
ulAttr |= FA_SYSTEM;
if( fs3.attrFile & FILE_DIRECTORY )
ulAttr |= FA_DIRECTORY;
if( fs3.attrFile & FILE_ARCHIVED )
ulAttr |= FA_ARCHIVE;
if( ulExtAttr | FILE_ATTRIBUTE_READONLY )
ulExtAttr |= 0x01240000; /* r--r--r-- */
else
ulExtAttr |= 0x01B60000; /* rw-rw-rw- */
if( ulExtAttr & FILE_ATTRIBUTE_DIRECTORY )
ulExtAttr |= 0x40000000;
else
ulExtAttr |= 0x80000000;
/* Please uncomment it if .exe, .bat and .com are executable files under OS2
ulLen = strlen( szZipName );
if( ulLen > 4 )
{
pString = &szZipName[ ulLen - 4 ];
if( hb_stricmp( pString, ".exe" ) == 0 || hb_stricmp( pString, ".com" ) == 0 ||
hb_stricmp( pString, ".bat" ) == 0 )
{
ulExtAttr |= 0x00490000; /* --x--x--x */
}
}
*/
}
else
fError = TRUE;
}
#else
{
int TODO; /* To force warning */
@@ -755,6 +839,34 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, char* szFileName, char* s
utime( szName, &utim );
}
#elif defined( HB_OS_DOS )
{
_chmod( szName, 1, ufi.external_fa & 0xFF );
}
#elif defined( HB_OS_OS2 )
{
FILESTATUS3 fs3;
APIRET ulrc;
ULONG ulAttr = FILE_NORMAL;
int iAttr = ufi.external_fa & 0xFF;
if( iAttr & FA_READONLY )
ulAttr |= FILE_READONLY;
if( iAttr & FA_HIDDEN )
ulAttr |= FILE_HIDDEN;
if( iAttr & FA_SYSTEM )
ulAttr |= FILE_SYSTEM;
if( iAttr & FA_ARCHIVE )
ulAttr |= FILE_ARCHIVED;
ulrc = DosQueryPathInfo( szName, FIL_STANDARD, &fs3, sizeof( fs3 ) );
if( ulrc == NO_ERROR )
{
fs3.attrFile = ulAttr;
ulrc = DosSetPathInfo( szName, FIL_STANDARD,
&fs3, sizeof( fs3 ), DSPI_WRTTHRU );
}
}
#else
{
int TODO; /* To force warning */