Beispiel #1
0
voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode)
{
    DWORD dwDesiredAccess, dwCreationDisposition, dwShareMode, dwFlagsAndAttributes;
    HANDLE hFile = NULL;
    WIN32FILE_IOWIN *iowin = NULL;

    win32_translate_open_mode(mode, &dwDesiredAccess, &dwCreationDisposition, &dwShareMode, &dwFlagsAndAttributes);

    if ((filename != NULL) && (dwDesiredAccess != 0))
    {
#ifdef IOWIN32_USING_WINRT_API
        hFile = CreateFile2((LPCWSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
#else
        hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
#endif
    }

    iowin = win32_build_iowin(hFile);
    if (iowin == NULL)
        return NULL;
    if (iowin->filename == NULL)
    {
        iowin->filenameLength = wcslen(filename) + 1;
        iowin->filename = (void*)malloc(iowin->filenameLength * sizeof(WCHAR));
        wcsncpy(iowin->filename, filename, iowin->filenameLength);
    }
    return iowin;
}
Beispiel #2
0
voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque, const void* filename, int mode)
{
    DWORD dwDesiredAccess, dwCreationDisposition, dwShareMode, dwFlagsAndAttributes ;
    HANDLE hFile = NULL;
    WIN32FILE_IOWIN *iowin = NULL;

    win32_translate_open_mode(mode, &dwDesiredAccess, &dwCreationDisposition, &dwShareMode, &dwFlagsAndAttributes);

    if ((filename != NULL) && (dwDesiredAccess != 0))
    {
#ifdef IOWIN32_USING_WINRT_API
        WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
        MultiByteToWideChar(CP_ACP, 0, (const char*)filename, -1, filenameW, FILENAME_MAX + 0x200);
        hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
#else
        hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
#endif
    }

    iowin = win32_build_iowin(hFile);
    if (iowin == NULL)
        return NULL;
    iowin->filenameLength = strlen(filename) + 1;
    iowin->filename = (void*)malloc(iowin->filenameLength * sizeof(char));
    strncpy(iowin->filename, filename, iowin->filenameLength);
    return iowin;
}
Beispiel #3
0
voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode)
{
    const char* mode_fopen = NULL;
    DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
    HANDLE hFile = NULL;

    win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);

#ifdef IOWIN32_USING_WINRT_API
#ifdef UNICODE
    if ((filename!=NULL) && (dwDesiredAccess != 0))
        hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
#else
    if ((filename!=NULL) && (dwDesiredAccess != 0))
    {
        WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
        MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200);
        hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
    }
#endif
#else
    if ((filename!=NULL) && (dwDesiredAccess != 0))
        hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
#endif

    return win32_build_iowin(hFile);
}
Beispiel #4
0
voidpf ZCALLBACK win32_open64_file_func (voidpf opaque, const void *filename, int mode)
{
    DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
    HANDLE hFile = NULL;

    win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);

    if ((filename!=NULL) && (dwDesiredAccess != 0))
        hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);

    return win32_build_iowin(hFile);
}
Beispiel #5
0
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const WCHAR* filename, int mode)
{
    const char* mode_fopen = NULL;
    DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
    HANDLE hFile = NULL;

    win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);

    if ((filename!=NULL) && (dwDesiredAccess != 0))
        hFile = CreateFileW(filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);

    return win32_build_iowin(hFile);
}
Beispiel #6
0
voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void *filename, int mode) {
	const char *mode_fopen = NULL;
	DWORD dwDesiredAccess, dwCreationDisposition, dwShareMode, dwFlagsAndAttributes ;
	HANDLE hFile = NULL;
	win32_translate_open_mode(mode, &dwDesiredAccess, &dwCreationDisposition, &dwShareMode, &dwFlagsAndAttributes);
#ifdef IOWIN32_USING_WINRT_API
	if ((filename != NULL) && (dwDesiredAccess != 0)) {
		hFile = CreateFile2((LPCWSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
	}
#else
	if ((filename != NULL) && (dwDesiredAccess != 0)) {
		hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
	}
#endif
	return win32_build_iowin(hFile);
}
Beispiel #7
0
voidpf ZCALLBACK win32_open64_file_func (voidpf opaque, const void* filename, int mode)
{
    DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
    HANDLE hFile = NULL;
    WIN32FILE_IOWIN *iowin = NULL;

    win32_translate_open_mode(mode, &dwDesiredAccess, &dwCreationDisposition, &dwShareMode, &dwFlagsAndAttributes);

    const TCHAR* filenameTC = NULL;
#if defined(IOWIN32_USING_WINRT_API) && !defined(UNICODE)
    WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
#endif
    if ((filename != NULL) && (dwDesiredAccess != 0))
    {
#ifdef IOWIN32_USING_WINRT_API
#ifdef UNICODE
        filenameTC = (LPCTSTR)filename;
        hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
#else
        MultiByteToWideChar(CP_ACP, 0, (const char*)filename, -1, filenameW, FILENAME_MAX + 0x200);
        hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
        filenameTC = filenameW;
#endif
#else
        filenameTC = (LPCTSTR)filename;
        hFile = CreateFile(filenameTC, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
#endif
    }

    iowin = win32_build_iowin(hFile);
    if (iowin == NULL)
        return NULL;
    iowin->filenameLength = _tcslen(filenameTC) + 1;
    iowin->filename = (void*)malloc(iowin->filenameLength * sizeof(TCHAR));
    _tcsncpy(iowin->filename, filenameTC, iowin->filenameLength);
    return iowin; 
}