Example #1
0
int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
{
    HANDLE Handle = ((WinApiFile *) opaque)->handle;
    LONG HighOrderPos;
    PLONG pHighOrderPos;
    DWORD rc;

    /* Get the high order 32-bits of the position */
    HighOrderPos = HIGHORDER_UINT64(pos);

    /*
     * MSDN: "If you do not need the high-order 32 bits, this
     *         pointer must be set to NULL."
     */
    pHighOrderPos = (HighOrderPos) ? &HighOrderPos : NULL;

    /* Move pointer "pos" count from start of file */
    rc = SetFilePointer(Handle, LOWORDER_UINT64(pos),
                        pHighOrderPos, FILE_BEGIN);

    if ( (rc == PHYSFS_INVALID_SET_FILE_POINTER) &&
         (GetLastError() != NO_ERROR) )
    {
        BAIL_MACRO(errcodeFromWinApi(), 0);
    } /* if */

    return 1;  /* No error occured */
} /* __PHYSFS_platformSeek */
Example #2
0
int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
{
	HANDLE Handle = ((WinApiFile *)opaque)->handle;
	BOOL rc;

	LARGE_INTEGER li;
	li.LowPart = LOWORDER_UINT64(pos);
	li.HighPart = HIGHORDER_UINT64(pos);

	rc = SetFilePointerEx(Handle, li, NULL, FILE_BEGIN);

	if (!rc && (GetLastError() != NO_ERROR))
	{
		BAIL_MACRO(errcodeFromWinApi(), 0);
	} /* if */

	return 1;  /* No error occured */
} /* __PHYSFS_platformSeek */
Example #3
0
int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
{
    HANDLE FileHandle = ((win32file *) opaque)->handle;
    DWORD HighOrderPos;
    DWORD *pHighOrderPos;
    DWORD rc;

    /* Get the high order 32-bits of the position */
    HighOrderPos = HIGHORDER_UINT64(pos);

    /*
     * MSDN: "If you do not need the high-order 32 bits, this
     *         pointer must be set to NULL."
     */
    pHighOrderPos = (HighOrderPos) ? &HighOrderPos : NULL;

    /*
     * !!! FIXME: MSDN: "Windows Me/98/95:  If the pointer
     * !!! FIXME:  lpDistanceToMoveHigh is not NULL, then it must
     * !!! FIXME:  point to either 0, INVALID_SET_FILE_POINTER, or
     * !!! FIXME:  the sign extension of the value of lDistanceToMove.
     * !!! FIXME:  Any other value will be rejected."
     */

    /* Move pointer "pos" count from start of file */
    rc = SetFilePointer(FileHandle, LOWORDER_UINT64(pos),
                        pHighOrderPos, FILE_BEGIN);

    if ( (rc == PHYSFS_INVALID_SET_FILE_POINTER) &&
            (GetLastError() != NO_ERROR) )
    {
        BAIL_MACRO(win32strerror(), 0);
    } /* if */

    return(1);  /* No error occured */
} /* __PHYSFS_platformSeek */