X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fwin32%2Ffunctions%2F_PDCLIB%2F_PDCLIB_open.c;h=a47af17f207353139c207d6aa7947afc76fc46b1;hb=abc15df6b9fae3374d24c7cf5c3ab94c605b2a6d;hp=a6ac387c8842dc1f476c376ac37d7f213554ade4;hpb=2b5783fd52d6fa36b0059a28a68eb818ca3bbfbd;p=pdclib diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_open.c b/platform/win32/functions/_PDCLIB/_PDCLIB_open.c index a6ac387..a47af17 100644 --- a/platform/win32/functions/_PDCLIB/_PDCLIB_open.c +++ b/platform/win32/functions/_PDCLIB/_PDCLIB_open.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* _PDCLIB_open( char const * const, int ) This file is part of the Public Domain C Library (PDCLib). @@ -13,11 +11,14 @@ #include #ifndef REGTEST -#include <_PDCLIB_glue.h> +#include "_PDCLIB_glue.h" #include +extern const _PDCLIB_fileops_t _PDCLIB_fileops; + void _PDCLIB_w32errno(void); -HANDLE _PDCLIB_open( char const * const filename, unsigned int mode ) +bool _PDCLIB_open( _PDCLIB_fd_t * pFd, const _PDCLIB_fileops_t ** pOps, + char const * const filename, unsigned int mode ) { DWORD desiredAccess; DWORD creationDisposition; @@ -51,7 +52,7 @@ HANDLE _PDCLIB_open( char const * const filename, unsigned int mode ) break; default: /* Invalid mode */ errno = EINVAL; - return NULL; + return false; } HANDLE fd = CreateFileA(filename, desiredAccess, @@ -75,7 +76,7 @@ HANDLE _PDCLIB_open( char const * const filename, unsigned int mode ) fprintf(stderr, "Error: %s\n", msgBuf); #endif _PDCLIB_w32errno(); - return NULL; + return false; } if(mode & _PDCLIB_FAPPEND) { @@ -85,17 +86,19 @@ HANDLE _PDCLIB_open( char const * const filename, unsigned int mode ) if(!ok) { _PDCLIB_w32errno(); CloseHandle(fd); - return NULL; + return false; } } - return fd; + pFd->pointer = fd; + *pOps = &_PDCLIB_fileops; + return true; } #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" #include #include