Added support for anonymous structs/unions on compilers that implement it.
This commit is contained in:
parent
87d95b7bc5
commit
311e456a64
@ -158,8 +158,8 @@ OpenSCManagerW( LPCWSTR lpMachineName, LPCWSTR lpDatabaseName,
|
|||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
AllocateLocallyUniqueId( PLUID lpluid )
|
AllocateLocallyUniqueId( PLUID lpluid )
|
||||||
{
|
{
|
||||||
lpluid->LowPart = time(NULL);
|
lpluid->s.LowPart = time(NULL);
|
||||||
lpluid->HighPart = 0;
|
lpluid->s.HighPart = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lPar
|
|||||||
|
|
||||||
*phDpa = (HDPA)NULL;
|
*phDpa = (HDPA)NULL;
|
||||||
|
|
||||||
position.LowPart = 0;
|
position.s.LowPart = 0;
|
||||||
position.HighPart = 0;
|
position.s.HighPart = 0;
|
||||||
|
|
||||||
errCode = IStream_Seek (pStream, position, STREAM_SEEK_CUR, &newPosition);
|
errCode = IStream_Seek (pStream, position, STREAM_SEEK_CUR, &newPosition);
|
||||||
if (errCode != S_OK)
|
if (errCode != S_OK)
|
||||||
|
@ -678,10 +678,10 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
|
|||||||
# error "statfs has no bfree/bavail member!"
|
# error "statfs has no bfree/bavail member!"
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
size->LowPart = (DWORD)bigsize;
|
size->s.LowPart = (DWORD)bigsize;
|
||||||
size->HighPart = (DWORD)(bigsize>>32);
|
size->s.HighPart = (DWORD)(bigsize>>32);
|
||||||
available->LowPart = (DWORD)bigavail;
|
available->s.LowPart = (DWORD)bigavail;
|
||||||
available->HighPart = (DWORD)(bigavail>>32);
|
available->s.HighPart = (DWORD)(bigavail>>32);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,37 +755,37 @@ BOOL WINAPI GetDiskFreeSpaceA( LPCSTR root, LPDWORD cluster_sectors,
|
|||||||
if (!DRIVE_GetFreeSpace(drive, &size, &available)) return FALSE;
|
if (!DRIVE_GetFreeSpace(drive, &size, &available)) return FALSE;
|
||||||
|
|
||||||
/* Cap the size and available at 2GB as per specs. */
|
/* Cap the size and available at 2GB as per specs. */
|
||||||
if ((size.HighPart) ||(size.LowPart > 0x7fffffff))
|
if ((size.s.HighPart) ||(size.s.LowPart > 0x7fffffff))
|
||||||
{
|
{
|
||||||
size.HighPart = 0;
|
size.s.HighPart = 0;
|
||||||
size.LowPart = 0x7fffffff;
|
size.s.LowPart = 0x7fffffff;
|
||||||
}
|
}
|
||||||
if ((available.HighPart) ||(available.LowPart > 0x7fffffff))
|
if ((available.s.HighPart) ||(available.s.LowPart > 0x7fffffff))
|
||||||
{
|
{
|
||||||
available.HighPart =0;
|
available.s.HighPart =0;
|
||||||
available.LowPart = 0x7fffffff;
|
available.s.LowPart = 0x7fffffff;
|
||||||
}
|
}
|
||||||
if (DRIVE_GetType(drive)==TYPE_CDROM) {
|
if (DRIVE_GetType(drive)==TYPE_CDROM) {
|
||||||
if (sector_bytes)
|
if (sector_bytes)
|
||||||
*sector_bytes = 2048;
|
*sector_bytes = 2048;
|
||||||
size.LowPart /= 2048;
|
size.s.LowPart /= 2048;
|
||||||
available.LowPart /= 2048;
|
available.s.LowPart /= 2048;
|
||||||
} else {
|
} else {
|
||||||
if (sector_bytes)
|
if (sector_bytes)
|
||||||
*sector_bytes = 512;
|
*sector_bytes = 512;
|
||||||
size.LowPart /= 512;
|
size.s.LowPart /= 512;
|
||||||
available.LowPart /= 512;
|
available.s.LowPart /= 512;
|
||||||
}
|
}
|
||||||
/* fixme: probably have to adjust those variables too for CDFS */
|
/* fixme: probably have to adjust those variables too for CDFS */
|
||||||
cluster_sec = 1;
|
cluster_sec = 1;
|
||||||
while (cluster_sec * 65536 < size.LowPart) cluster_sec *= 2;
|
while (cluster_sec * 65536 < size.s.LowPart) cluster_sec *= 2;
|
||||||
|
|
||||||
if (cluster_sectors)
|
if (cluster_sectors)
|
||||||
*cluster_sectors = cluster_sec;
|
*cluster_sectors = cluster_sec;
|
||||||
if (free_clusters)
|
if (free_clusters)
|
||||||
*free_clusters = available.LowPart / cluster_sec;
|
*free_clusters = available.s.LowPart / cluster_sec;
|
||||||
if (total_clusters)
|
if (total_clusters)
|
||||||
*total_clusters = size.LowPart / cluster_sec;
|
*total_clusters = size.s.LowPart / cluster_sec;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,14 +846,14 @@ BOOL WINAPI GetDiskFreeSpaceExA( LPCSTR root,
|
|||||||
|
|
||||||
if (total)
|
if (total)
|
||||||
{
|
{
|
||||||
total->HighPart = size.HighPart;
|
total->s.HighPart = size.s.HighPart;
|
||||||
total->LowPart = size.LowPart ;
|
total->s.LowPart = size.s.LowPart ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalfree)
|
if (totalfree)
|
||||||
{
|
{
|
||||||
totalfree->HighPart = available.HighPart;
|
totalfree->s.HighPart = available.s.HighPart;
|
||||||
totalfree->LowPart = available.LowPart ;
|
totalfree->s.LowPart = available.s.LowPart ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avail)
|
if (avail)
|
||||||
@ -877,8 +877,8 @@ BOOL WINAPI GetDiskFreeSpaceExA( LPCSTR root,
|
|||||||
|
|
||||||
/* Quick hack, should eventually be fixed to work 100% with
|
/* Quick hack, should eventually be fixed to work 100% with
|
||||||
Windows2000 (see comment above). */
|
Windows2000 (see comment above). */
|
||||||
avail->HighPart = available.HighPart;
|
avail->s.HighPart = available.s.HighPart;
|
||||||
avail->LowPart = available.LowPart ;
|
avail->s.LowPart = available.s.LowPart ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -908,16 +908,20 @@ typedef struct _TOKEN_GROUPS {
|
|||||||
* LUID_AND_ATTRIBUTES
|
* LUID_AND_ATTRIBUTES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _LARGE_INTEGER
|
typedef union _LARGE_INTEGER {
|
||||||
{
|
struct {
|
||||||
DWORD LowPart;
|
DWORD LowPart;
|
||||||
LONG HighPart;
|
LONG HighPart;
|
||||||
|
} DUMMYSTRUCTNAME;
|
||||||
|
LONGLONG QuadPart;
|
||||||
} LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER;
|
} LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER;
|
||||||
|
|
||||||
typedef struct _ULARGE_INTEGER
|
typedef union _ULARGE_INTEGER {
|
||||||
{
|
struct {
|
||||||
DWORD LowPart;
|
DWORD LowPart;
|
||||||
DWORD HighPart;
|
LONG HighPart;
|
||||||
|
} DUMMYSTRUCTNAME;
|
||||||
|
LONGLONG QuadPart;
|
||||||
} ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER;
|
} ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -147,19 +147,20 @@ typedef struct tagBLOB
|
|||||||
|
|
||||||
#ifndef _tagCY_DEFINED
|
#ifndef _tagCY_DEFINED
|
||||||
#define _tagCY_DEFINED
|
#define _tagCY_DEFINED
|
||||||
typedef union tagCY
|
|
||||||
{
|
typedef union tagCY {
|
||||||
struct {
|
struct {
|
||||||
#ifdef BIG_ENDIAN
|
#ifdef BIG_ENDIAN
|
||||||
long Hi;
|
LONG Hi;
|
||||||
long Lo;
|
LONG Lo;
|
||||||
#else
|
#else /* defined(BIG_ENDIAN) */
|
||||||
unsigned long Lo;
|
ULONG Lo;
|
||||||
long Hi;
|
LONG Hi;
|
||||||
#endif
|
#endif /* defined(BIG_ENDIAN) */
|
||||||
} u;
|
} DUMMYSTRUCTNAME;
|
||||||
LONGLONG int64;
|
LONGLONG int64;
|
||||||
} CY;
|
} CY;
|
||||||
|
|
||||||
#endif /* _tagCY_DEFINED */
|
#endif /* _tagCY_DEFINED */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
10
msdos/vxd.c
10
msdos/vxd.c
@ -1044,8 +1044,8 @@ void WINAPI VXD_Win32s( CONTEXT86 *context )
|
|||||||
TRACE("NtCreateSection: name=%s\n", atom? name : NULL);
|
TRACE("NtCreateSection: name=%s\n", atom? name : NULL);
|
||||||
|
|
||||||
result = CreateFileMappingA(hFile, NULL, protect,
|
result = CreateFileMappingA(hFile, NULL, protect,
|
||||||
size? size->HighPart : 0,
|
size? size->s.HighPart : 0,
|
||||||
size? size->LowPart : 0,
|
size? size->s.LowPart : 0,
|
||||||
atom? name : NULL);
|
atom? name : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1207,12 +1207,12 @@ void WINAPI VXD_Win32s( CONTEXT86 *context )
|
|||||||
InheritDisposition, AllocationType, Protect);
|
InheritDisposition, AllocationType, Protect);
|
||||||
TRACE("NtMapViewOfSection: "
|
TRACE("NtMapViewOfSection: "
|
||||||
"base=%lx, offset=%lx, size=%lx, access=%lx\n",
|
"base=%lx, offset=%lx, size=%lx, access=%lx\n",
|
||||||
(DWORD)address, SectionOffset? SectionOffset->LowPart : 0,
|
(DWORD)address, SectionOffset? SectionOffset->s.LowPart : 0,
|
||||||
ViewSize? *ViewSize : 0, access);
|
ViewSize? *ViewSize : 0, access);
|
||||||
|
|
||||||
result = (DWORD)MapViewOfFileEx(SectionHandle, access,
|
result = (DWORD)MapViewOfFileEx(SectionHandle, access,
|
||||||
SectionOffset? SectionOffset->HighPart : 0,
|
SectionOffset? SectionOffset->s.HighPart : 0,
|
||||||
SectionOffset? SectionOffset->LowPart : 0,
|
SectionOffset? SectionOffset->s.LowPart : 0,
|
||||||
ViewSize? *ViewSize : 0, address);
|
ViewSize? *ViewSize : 0, address);
|
||||||
|
|
||||||
TRACE("NtMapViewOfSection: result=%lx\n", result);
|
TRACE("NtMapViewOfSection: result=%lx\n", result);
|
||||||
|
@ -261,9 +261,9 @@ HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface,
|
|||||||
|
|
||||||
/* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */
|
/* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */
|
||||||
/* more than the number of bytes used by AntiMoniker::Save function */
|
/* more than the number of bytes used by AntiMoniker::Save function */
|
||||||
pcbSize->LowPart = sizeof(DWORD)+16;
|
pcbSize->s.LowPart = sizeof(DWORD)+16;
|
||||||
|
|
||||||
pcbSize->HighPart=0;
|
pcbSize->s.HighPart=0;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -409,8 +409,8 @@ HRESULT WINAPI CompositeMonikerImpl_GetSizeMax(IMoniker* iface,ULARGE_INTEGER* p
|
|||||||
if (pcbSize!=NULL)
|
if (pcbSize!=NULL)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
pcbSize->LowPart =0;
|
pcbSize->s.LowPart =0;
|
||||||
pcbSize->HighPart=0;
|
pcbSize->s.HighPart=0;
|
||||||
|
|
||||||
IMoniker_Enum(iface,TRUE,&enumMk);
|
IMoniker_Enum(iface,TRUE,&enumMk);
|
||||||
|
|
||||||
@ -420,8 +420,8 @@ HRESULT WINAPI CompositeMonikerImpl_GetSizeMax(IMoniker* iface,ULARGE_INTEGER* p
|
|||||||
|
|
||||||
IMoniker_Release(pmk);
|
IMoniker_Release(pmk);
|
||||||
|
|
||||||
pcbSize->LowPart +=ptmpSize.LowPart;
|
pcbSize->s.LowPart +=ptmpSize.s.LowPart;
|
||||||
pcbSize->HighPart+=ptmpSize.HighPart;
|
pcbSize->s.HighPart+=ptmpSize.s.HighPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumMoniker_Release(enumMk);
|
IEnumMoniker_Release(enumMk);
|
||||||
|
@ -773,8 +773,8 @@ static HMETAFILE DataCache_ReadPresMetafile(
|
|||||||
/*
|
/*
|
||||||
* Skip the header
|
* Skip the header
|
||||||
*/
|
*/
|
||||||
offset.HighPart = 0;
|
offset.s.HighPart = 0;
|
||||||
offset.LowPart = sizeof(PresentationDataHeader);
|
offset.s.LowPart = sizeof(PresentationDataHeader);
|
||||||
|
|
||||||
hres = IStream_Seek(
|
hres = IStream_Seek(
|
||||||
presStream,
|
presStream,
|
||||||
@ -787,7 +787,7 @@ static HMETAFILE DataCache_ReadPresMetafile(
|
|||||||
*/
|
*/
|
||||||
metafileBits = HeapAlloc(GetProcessHeap(),
|
metafileBits = HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
streamInfo.cbSize.LowPart);
|
streamInfo.cbSize.s.LowPart);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the metafile bits.
|
* Read the metafile bits.
|
||||||
@ -795,7 +795,7 @@ static HMETAFILE DataCache_ReadPresMetafile(
|
|||||||
hres = IStream_Read(
|
hres = IStream_Read(
|
||||||
presStream,
|
presStream,
|
||||||
metafileBits,
|
metafileBits,
|
||||||
streamInfo.cbSize.LowPart,
|
streamInfo.cbSize.s.LowPart,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -803,7 +803,7 @@ static HMETAFILE DataCache_ReadPresMetafile(
|
|||||||
*/
|
*/
|
||||||
if (SUCCEEDED(hres))
|
if (SUCCEEDED(hres))
|
||||||
{
|
{
|
||||||
newMetafile = SetMetaFileBitsEx(streamInfo.cbSize.LowPart, metafileBits);
|
newMetafile = SetMetaFileBitsEx(streamInfo.cbSize.s.LowPart, metafileBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -423,8 +423,8 @@ HRESULT WINAPI FileMonikerImpl_GetSizeMax(IMoniker* iface,
|
|||||||
sizeof(WORD)+ /* constant : 0x3 */
|
sizeof(WORD)+ /* constant : 0x3 */
|
||||||
len*sizeof(WCHAR); /* unicde filePath string */
|
len*sizeof(WCHAR); /* unicde filePath string */
|
||||||
|
|
||||||
pcbSize->LowPart=sizeMAx;
|
pcbSize->s.LowPart=sizeMAx;
|
||||||
pcbSize->HighPart=0;
|
pcbSize->s.HighPart=0;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -257,14 +257,14 @@ HGLOBALStreamImpl* HGLOBALStreamImpl_Construct(
|
|||||||
/*
|
/*
|
||||||
* Start the stream at the begining.
|
* Start the stream at the begining.
|
||||||
*/
|
*/
|
||||||
newStream->currentPosition.HighPart = 0;
|
newStream->currentPosition.s.HighPart = 0;
|
||||||
newStream->currentPosition.LowPart = 0;
|
newStream->currentPosition.s.LowPart = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the size of the stream to the size of the handle.
|
* Initialize the size of the stream to the size of the handle.
|
||||||
*/
|
*/
|
||||||
newStream->streamSize.HighPart = 0;
|
newStream->streamSize.s.HighPart = 0;
|
||||||
newStream->streamSize.LowPart = GlobalSize(newStream->supportHandle);
|
newStream->streamSize.s.LowPart = GlobalSize(newStream->supportHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newStream;
|
return newStream;
|
||||||
@ -420,19 +420,19 @@ HRESULT WINAPI HGLOBALStreamImpl_Read(
|
|||||||
* Using the known size of the stream, calculate the number of bytes
|
* Using the known size of the stream, calculate the number of bytes
|
||||||
* to read from the block chain
|
* to read from the block chain
|
||||||
*/
|
*/
|
||||||
bytesToReadFromBuffer = MIN( This->streamSize.LowPart - This->currentPosition.LowPart, cb);
|
bytesToReadFromBuffer = MIN( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock the buffer in position and copy the data.
|
* Lock the buffer in position and copy the data.
|
||||||
*/
|
*/
|
||||||
supportBuffer = GlobalLock(This->supportHandle);
|
supportBuffer = GlobalLock(This->supportHandle);
|
||||||
|
|
||||||
memcpy(pv, (char *) supportBuffer+This->currentPosition.LowPart, bytesToReadFromBuffer);
|
memcpy(pv, (char *) supportBuffer+This->currentPosition.s.LowPart, bytesToReadFromBuffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move the current position to the new position
|
* Move the current position to the new position
|
||||||
*/
|
*/
|
||||||
This->currentPosition.LowPart+=bytesToReadFromBuffer;
|
This->currentPosition.s.LowPart+=bytesToReadFromBuffer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the number of bytes read.
|
* Return the number of bytes read.
|
||||||
@ -493,14 +493,14 @@ HRESULT WINAPI HGLOBALStreamImpl_Write(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newSize.HighPart = 0;
|
newSize.s.HighPart = 0;
|
||||||
newSize.LowPart = This->currentPosition.LowPart + cb;
|
newSize.s.LowPart = This->currentPosition.s.LowPart + cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify if we need to grow the stream
|
* Verify if we need to grow the stream
|
||||||
*/
|
*/
|
||||||
if (newSize.LowPart > This->streamSize.LowPart)
|
if (newSize.s.LowPart > This->streamSize.s.LowPart)
|
||||||
{
|
{
|
||||||
/* grow stream */
|
/* grow stream */
|
||||||
IStream_SetSize(iface, newSize);
|
IStream_SetSize(iface, newSize);
|
||||||
@ -511,12 +511,12 @@ HRESULT WINAPI HGLOBALStreamImpl_Write(
|
|||||||
*/
|
*/
|
||||||
supportBuffer = GlobalLock(This->supportHandle);
|
supportBuffer = GlobalLock(This->supportHandle);
|
||||||
|
|
||||||
memcpy((char *) supportBuffer+This->currentPosition.LowPart, pv, cb);
|
memcpy((char *) supportBuffer+This->currentPosition.s.LowPart, pv, cb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move the current position to the new position
|
* Move the current position to the new position
|
||||||
*/
|
*/
|
||||||
This->currentPosition.LowPart+=cb;
|
This->currentPosition.s.LowPart+=cb;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the number of bytes read.
|
* Return the number of bytes read.
|
||||||
@ -550,7 +550,7 @@ HRESULT WINAPI HGLOBALStreamImpl_Seek(
|
|||||||
ULARGE_INTEGER newPosition;
|
ULARGE_INTEGER newPosition;
|
||||||
|
|
||||||
TRACE("(%p, %ld, %ld, %p)\n", iface,
|
TRACE("(%p, %ld, %ld, %p)\n", iface,
|
||||||
dlibMove.LowPart, dwOrigin, plibNewPosition);
|
dlibMove.s.LowPart, dwOrigin, plibNewPosition);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The caller is allowed to pass in NULL as the new position return value.
|
* The caller is allowed to pass in NULL as the new position return value.
|
||||||
@ -569,8 +569,8 @@ HRESULT WINAPI HGLOBALStreamImpl_Seek(
|
|||||||
switch (dwOrigin)
|
switch (dwOrigin)
|
||||||
{
|
{
|
||||||
case STREAM_SEEK_SET:
|
case STREAM_SEEK_SET:
|
||||||
plibNewPosition->HighPart = 0;
|
plibNewPosition->s.HighPart = 0;
|
||||||
plibNewPosition->LowPart = 0;
|
plibNewPosition->s.LowPart = 0;
|
||||||
break;
|
break;
|
||||||
case STREAM_SEEK_CUR:
|
case STREAM_SEEK_CUR:
|
||||||
*plibNewPosition = This->currentPosition;
|
*plibNewPosition = This->currentPosition;
|
||||||
@ -585,13 +585,13 @@ HRESULT WINAPI HGLOBALStreamImpl_Seek(
|
|||||||
/*
|
/*
|
||||||
* We don't support files with offsets of 64 bits.
|
* We don't support files with offsets of 64 bits.
|
||||||
*/
|
*/
|
||||||
assert(dlibMove.HighPart == 0);
|
assert(dlibMove.s.HighPart == 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if we end-up before the beginning of the file. That should trigger an
|
* Check if we end-up before the beginning of the file. That should trigger an
|
||||||
* error.
|
* error.
|
||||||
*/
|
*/
|
||||||
if ( (dlibMove.LowPart<0) && (plibNewPosition->LowPart < (ULONG)(-dlibMove.LowPart)) )
|
if ( (dlibMove.s.LowPart<0) && (plibNewPosition->s.LowPart < (ULONG)(-dlibMove.s.LowPart)) )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* I don't know what error to send there.
|
* I don't know what error to send there.
|
||||||
@ -604,7 +604,7 @@ HRESULT WINAPI HGLOBALStreamImpl_Seek(
|
|||||||
* If the file pointer ends-up after the end of the stream, the next Write operation will
|
* If the file pointer ends-up after the end of the stream, the next Write operation will
|
||||||
* make the file larger. This is how it is documented.
|
* make the file larger. This is how it is documented.
|
||||||
*/
|
*/
|
||||||
plibNewPosition->LowPart += dlibMove.LowPart;
|
plibNewPosition->s.LowPart += dlibMove.s.LowPart;
|
||||||
This->currentPosition = *plibNewPosition;
|
This->currentPosition = *plibNewPosition;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -625,25 +625,25 @@ HRESULT WINAPI HGLOBALStreamImpl_SetSize(
|
|||||||
{
|
{
|
||||||
HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
|
HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
|
||||||
|
|
||||||
TRACE("(%p, %ld)\n", iface, libNewSize.LowPart);
|
TRACE("(%p, %ld)\n", iface, libNewSize.s.LowPart);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As documented.
|
* As documented.
|
||||||
*/
|
*/
|
||||||
if (libNewSize.HighPart != 0)
|
if (libNewSize.s.HighPart != 0)
|
||||||
return STG_E_INVALIDFUNCTION;
|
return STG_E_INVALIDFUNCTION;
|
||||||
|
|
||||||
if (This->streamSize.LowPart == libNewSize.LowPart)
|
if (This->streamSize.s.LowPart == libNewSize.s.LowPart)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Re allocate the HGlobal to fit the new size of the stream.
|
* Re allocate the HGlobal to fit the new size of the stream.
|
||||||
*/
|
*/
|
||||||
This->supportHandle = GlobalReAlloc(This->supportHandle,
|
This->supportHandle = GlobalReAlloc(This->supportHandle,
|
||||||
libNewSize.LowPart,
|
libNewSize.s.LowPart,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
This->streamSize.LowPart = libNewSize.LowPart;
|
This->streamSize.s.LowPart = libNewSize.s.LowPart;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -669,7 +669,7 @@ HRESULT WINAPI HGLOBALStreamImpl_CopyTo(
|
|||||||
ULARGE_INTEGER totalBytesWritten;
|
ULARGE_INTEGER totalBytesWritten;
|
||||||
|
|
||||||
TRACE("(%p, %p, %ld, %p, %p)\n", iface, pstm,
|
TRACE("(%p, %p, %ld, %p, %p)\n", iface, pstm,
|
||||||
cb.LowPart, pcbRead, pcbWritten);
|
cb.s.LowPart, pcbRead, pcbWritten);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sanity check
|
* Sanity check
|
||||||
@ -677,28 +677,28 @@ HRESULT WINAPI HGLOBALStreamImpl_CopyTo(
|
|||||||
if ( pstm == 0 )
|
if ( pstm == 0 )
|
||||||
return STG_E_INVALIDPOINTER;
|
return STG_E_INVALIDPOINTER;
|
||||||
|
|
||||||
totalBytesRead.LowPart = totalBytesRead.HighPart = 0;
|
totalBytesRead.s.LowPart = totalBytesRead.s.HighPart = 0;
|
||||||
totalBytesWritten.LowPart = totalBytesWritten.HighPart = 0;
|
totalBytesWritten.s.LowPart = totalBytesWritten.s.HighPart = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* use stack to store data temporarly
|
* use stack to store data temporarly
|
||||||
* there is surely more performant way of doing it, for now this basic
|
* there is surely more performant way of doing it, for now this basic
|
||||||
* implementation will do the job
|
* implementation will do the job
|
||||||
*/
|
*/
|
||||||
while ( cb.LowPart > 0 )
|
while ( cb.s.LowPart > 0 )
|
||||||
{
|
{
|
||||||
if ( cb.LowPart >= 128 )
|
if ( cb.s.LowPart >= 128 )
|
||||||
copySize = 128;
|
copySize = 128;
|
||||||
else
|
else
|
||||||
copySize = cb.LowPart;
|
copySize = cb.s.LowPart;
|
||||||
|
|
||||||
IStream_Read(iface, tmpBuffer, copySize, &bytesRead);
|
IStream_Read(iface, tmpBuffer, copySize, &bytesRead);
|
||||||
|
|
||||||
totalBytesRead.LowPart += bytesRead;
|
totalBytesRead.s.LowPart += bytesRead;
|
||||||
|
|
||||||
IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten);
|
IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten);
|
||||||
|
|
||||||
totalBytesWritten.LowPart += bytesWritten;
|
totalBytesWritten.s.LowPart += bytesWritten;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that read & write operations were succesfull
|
* Check that read & write operations were succesfull
|
||||||
@ -710,9 +710,9 @@ HRESULT WINAPI HGLOBALStreamImpl_CopyTo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bytesRead!=copySize)
|
if (bytesRead!=copySize)
|
||||||
cb.LowPart = 0;
|
cb.s.LowPart = 0;
|
||||||
else
|
else
|
||||||
cb.LowPart -= bytesRead;
|
cb.s.LowPart -= bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -720,14 +720,14 @@ HRESULT WINAPI HGLOBALStreamImpl_CopyTo(
|
|||||||
*/
|
*/
|
||||||
if (pcbRead)
|
if (pcbRead)
|
||||||
{
|
{
|
||||||
pcbRead->LowPart = totalBytesRead.LowPart;
|
pcbRead->s.LowPart = totalBytesRead.s.LowPart;
|
||||||
pcbRead->HighPart = totalBytesRead.HighPart;
|
pcbRead->s.HighPart = totalBytesRead.s.HighPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcbWritten)
|
if (pcbWritten)
|
||||||
{
|
{
|
||||||
pcbWritten->LowPart = totalBytesWritten.LowPart;
|
pcbWritten->s.LowPart = totalBytesWritten.s.LowPart;
|
||||||
pcbWritten->HighPart = totalBytesWritten.HighPart;
|
pcbWritten->s.HighPart = totalBytesWritten.s.HighPart;
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -322,13 +322,13 @@ HRESULT WINAPI ItemMonikerImpl_GetSizeMax(IMoniker* iface,
|
|||||||
|
|
||||||
/* for more details see ItemMonikerImpl_Save coments */
|
/* for more details see ItemMonikerImpl_Save coments */
|
||||||
|
|
||||||
pcbSize->LowPart = sizeof(DWORD) + /* DWORD witch contains delimiter length */
|
pcbSize->s.LowPart = sizeof(DWORD) + /* DWORD witch contains delimiter length */
|
||||||
delimiterLength + /* item delimiter string */
|
delimiterLength + /* item delimiter string */
|
||||||
sizeof(DWORD) + /* DWORD witch contains item name length */
|
sizeof(DWORD) + /* DWORD witch contains item name length */
|
||||||
nameLength + /* item name string */
|
nameLength + /* item name string */
|
||||||
34; /* this constant was added ! because when I tested this function it usually */
|
34; /* this constant was added ! because when I tested this function it usually */
|
||||||
/* returns 34 bytes more than the number of bytes used by IMoniker::Save function */
|
/* returns 34 bytes more than the number of bytes used by IMoniker::Save function */
|
||||||
pcbSize->HighPart=0;
|
pcbSize->s.HighPart=0;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -215,8 +215,8 @@ HGLOBALLockBytesImpl* HGLOBALLockBytesImpl_Construct(HGLOBAL hGlobal,
|
|||||||
/*
|
/*
|
||||||
* Initialize the size of the array to the size of the handle.
|
* Initialize the size of the array to the size of the handle.
|
||||||
*/
|
*/
|
||||||
newLockBytes->byteArraySize.HighPart = 0;
|
newLockBytes->byteArraySize.s.HighPart = 0;
|
||||||
newLockBytes->byteArraySize.LowPart = GlobalSize(
|
newLockBytes->byteArraySize.s.LowPart = GlobalSize(
|
||||||
newLockBytes->supportHandle);
|
newLockBytes->supportHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,15 +365,15 @@ HRESULT WINAPI HGLOBALLockBytesImpl_ReadAt(
|
|||||||
/*
|
/*
|
||||||
* Make sure the offset is valid.
|
* Make sure the offset is valid.
|
||||||
*/
|
*/
|
||||||
if (ulOffset.LowPart > This->byteArraySize.LowPart)
|
if (ulOffset.s.LowPart > This->byteArraySize.s.LowPart)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Using the known size of the array, calculate the number of bytes
|
* Using the known size of the array, calculate the number of bytes
|
||||||
* to read.
|
* to read.
|
||||||
*/
|
*/
|
||||||
bytesToReadFromBuffer = MIN(This->byteArraySize.LowPart -
|
bytesToReadFromBuffer = MIN(This->byteArraySize.s.LowPart -
|
||||||
ulOffset.LowPart, cb);
|
ulOffset.s.LowPart, cb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock the buffer in position and copy the data.
|
* Lock the buffer in position and copy the data.
|
||||||
@ -381,7 +381,7 @@ HRESULT WINAPI HGLOBALLockBytesImpl_ReadAt(
|
|||||||
supportBuffer = GlobalLock(This->supportHandle);
|
supportBuffer = GlobalLock(This->supportHandle);
|
||||||
|
|
||||||
memcpy(pv,
|
memcpy(pv,
|
||||||
(char *) supportBuffer + ulOffset.LowPart,
|
(char *) supportBuffer + ulOffset.s.LowPart,
|
||||||
bytesToReadFromBuffer);
|
bytesToReadFromBuffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -440,14 +440,14 @@ HRESULT WINAPI HGLOBALLockBytesImpl_WriteAt(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newSize.HighPart = 0;
|
newSize.s.HighPart = 0;
|
||||||
newSize.LowPart = ulOffset.LowPart + cb;
|
newSize.s.LowPart = ulOffset.s.LowPart + cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify if we need to grow the stream
|
* Verify if we need to grow the stream
|
||||||
*/
|
*/
|
||||||
if (newSize.LowPart > This->byteArraySize.LowPart)
|
if (newSize.s.LowPart > This->byteArraySize.s.LowPart)
|
||||||
{
|
{
|
||||||
/* grow stream */
|
/* grow stream */
|
||||||
if (HGLOBALLockBytesImpl_SetSize(iface, newSize) == STG_E_MEDIUMFULL)
|
if (HGLOBALLockBytesImpl_SetSize(iface, newSize) == STG_E_MEDIUMFULL)
|
||||||
@ -459,7 +459,7 @@ HRESULT WINAPI HGLOBALLockBytesImpl_WriteAt(
|
|||||||
*/
|
*/
|
||||||
supportBuffer = GlobalLock(This->supportHandle);
|
supportBuffer = GlobalLock(This->supportHandle);
|
||||||
|
|
||||||
memcpy((char *) supportBuffer + ulOffset.LowPart, pv, cb);
|
memcpy((char *) supportBuffer + ulOffset.s.LowPart, pv, cb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the number of bytes written.
|
* Return the number of bytes written.
|
||||||
@ -500,23 +500,23 @@ HRESULT WINAPI HGLOBALLockBytesImpl_SetSize(
|
|||||||
/*
|
/*
|
||||||
* As documented.
|
* As documented.
|
||||||
*/
|
*/
|
||||||
if (libNewSize.HighPart != 0)
|
if (libNewSize.s.HighPart != 0)
|
||||||
return STG_E_INVALIDFUNCTION;
|
return STG_E_INVALIDFUNCTION;
|
||||||
|
|
||||||
if (This->byteArraySize.LowPart == libNewSize.LowPart)
|
if (This->byteArraySize.s.LowPart == libNewSize.s.LowPart)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Re allocate the HGlobal to fit the new size of the stream.
|
* Re allocate the HGlobal to fit the new size of the stream.
|
||||||
*/
|
*/
|
||||||
This->supportHandle = GlobalReAlloc(This->supportHandle,
|
This->supportHandle = GlobalReAlloc(This->supportHandle,
|
||||||
libNewSize.LowPart,
|
libNewSize.s.LowPart,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (This->supportHandle == 0)
|
if (This->supportHandle == 0)
|
||||||
return STG_E_MEDIUMFULL;
|
return STG_E_MEDIUMFULL;
|
||||||
|
|
||||||
This->byteArraySize.LowPart = libNewSize.LowPart;
|
This->byteArraySize.s.LowPart = libNewSize.s.LowPart;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -540,8 +540,8 @@ static HRESULT WINAPI OLEFontImpl_get_Size(
|
|||||||
if (psize==0)
|
if (psize==0)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
psize->u.Hi = 0;
|
psize->s.Hi = 0;
|
||||||
psize->u.Lo = this->description.cySize.u.Lo;
|
psize->s.Lo = this->description.cySize.s.Lo;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -557,8 +557,8 @@ static HRESULT WINAPI OLEFontImpl_put_Size(
|
|||||||
{
|
{
|
||||||
_ICOM_THIS(OLEFontImpl, iface);
|
_ICOM_THIS(OLEFontImpl, iface);
|
||||||
|
|
||||||
this->description.cySize.u.Hi = 0;
|
this->description.cySize.s.Hi = 0;
|
||||||
this->description.cySize.u.Lo = this->description.cySize.u.Lo;
|
this->description.cySize.s.Lo = this->description.cySize.s.Lo;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -810,7 +810,7 @@ static HRESULT WINAPI OLEFontImpl_get_hFont(
|
|||||||
*/
|
*/
|
||||||
IFont_get_Size(iface, &cySize);
|
IFont_get_Size(iface, &cySize);
|
||||||
|
|
||||||
fontHeight = MulDiv(cySize.u.Lo, 2540L, 72L);
|
fontHeight = MulDiv(cySize.s.Lo, 2540L, 72L);
|
||||||
fontHeight = MulDiv(fontHeight, this->cyLogical,this->cyHimetric);
|
fontHeight = MulDiv(fontHeight, this->cyLogical,this->cyHimetric);
|
||||||
|
|
||||||
memset(&logFont, 0, sizeof(LOGFONTW));
|
memset(&logFont, 0, sizeof(LOGFONTW));
|
||||||
@ -1232,12 +1232,12 @@ static HRESULT WINAPI OLEFontImpl_Load(
|
|||||||
/*
|
/*
|
||||||
* Size
|
* Size
|
||||||
*/
|
*/
|
||||||
IStream_Read(pLoadStream, &this->description.cySize.u.Lo, 4, &cbRead);
|
IStream_Read(pLoadStream, &this->description.cySize.s.Lo, 4, &cbRead);
|
||||||
|
|
||||||
if (cbRead!=4)
|
if (cbRead!=4)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
this->description.cySize.u.Hi = 0;
|
this->description.cySize.s.Hi = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FontName
|
* FontName
|
||||||
@ -1327,7 +1327,7 @@ static HRESULT WINAPI OLEFontImpl_Save(
|
|||||||
/*
|
/*
|
||||||
* Size
|
* Size
|
||||||
*/
|
*/
|
||||||
IStream_Write(pOutStream, &this->description.cySize.u.Lo, 4, &cbWritten);
|
IStream_Write(pOutStream, &this->description.cySize.s.Lo, 4, &cbWritten);
|
||||||
|
|
||||||
if (cbWritten!=4)
|
if (cbWritten!=4)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
@ -1379,18 +1379,18 @@ static HRESULT WINAPI OLEFontImpl_GetSizeMax(
|
|||||||
if (pcbSize==NULL)
|
if (pcbSize==NULL)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
pcbSize->HighPart = 0;
|
pcbSize->s.HighPart = 0;
|
||||||
pcbSize->LowPart = 0;
|
pcbSize->s.LowPart = 0;
|
||||||
|
|
||||||
pcbSize->LowPart += sizeof(BYTE); /* Version */
|
pcbSize->s.LowPart += sizeof(BYTE); /* Version */
|
||||||
pcbSize->LowPart += sizeof(WORD); /* Lang code */
|
pcbSize->s.LowPart += sizeof(WORD); /* Lang code */
|
||||||
pcbSize->LowPart += sizeof(BYTE); /* Flags */
|
pcbSize->s.LowPart += sizeof(BYTE); /* Flags */
|
||||||
pcbSize->LowPart += sizeof(WORD); /* Weight */
|
pcbSize->s.LowPart += sizeof(WORD); /* Weight */
|
||||||
pcbSize->LowPart += sizeof(DWORD); /* Size */
|
pcbSize->s.LowPart += sizeof(DWORD); /* Size */
|
||||||
pcbSize->LowPart += sizeof(BYTE); /* StrLength */
|
pcbSize->s.LowPart += sizeof(BYTE); /* StrLength */
|
||||||
|
|
||||||
if (this->description.lpstrName!=0)
|
if (this->description.lpstrName!=0)
|
||||||
pcbSize->LowPart += lstrlenW(this->description.lpstrName);
|
pcbSize->s.LowPart += lstrlenW(this->description.lpstrName);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ static BOOL BIGBLOCKFILE_FileInit(LPBIGBLOCKFILE This, HANDLE hFile)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
This->filesize.LowPart = GetFileSize(This->hfile, NULL);
|
This->filesize.s.LowPart = GetFileSize(This->hfile, NULL);
|
||||||
|
|
||||||
/* create the mapped pages list
|
/* create the mapped pages list
|
||||||
*/
|
*/
|
||||||
@ -221,8 +221,8 @@ static BOOL BIGBLOCKFILE_MemInit(LPBIGBLOCKFILE This, ILockBytes* plkbyt)
|
|||||||
*/
|
*/
|
||||||
ILockBytes_AddRef(This->pLkbyt);
|
ILockBytes_AddRef(This->pLkbyt);
|
||||||
|
|
||||||
This->filesize.LowPart = GlobalSize(This->hbytearray);
|
This->filesize.s.LowPart = GlobalSize(This->hbytearray);
|
||||||
This->filesize.HighPart = 0;
|
This->filesize.s.HighPart = 0;
|
||||||
|
|
||||||
This->pbytearray = GlobalLock(This->hbytearray);
|
This->pbytearray = GlobalLock(This->hbytearray);
|
||||||
|
|
||||||
@ -289,8 +289,8 @@ void* BIGBLOCKFILE_GetROBigBlock(
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ((This->blocksize * (index + 1)) >
|
if ((This->blocksize * (index + 1)) >
|
||||||
(This->filesize.LowPart +
|
(This->filesize.s.LowPart +
|
||||||
(This->blocksize - (This->filesize.LowPart % This->blocksize))))
|
(This->blocksize - (This->filesize.s.LowPart % This->blocksize))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return BIGBLOCKFILE_GetBigBlockPointer(This, index, FILE_MAP_READ);
|
return BIGBLOCKFILE_GetBigBlockPointer(This, index, FILE_MAP_READ);
|
||||||
@ -316,12 +316,12 @@ void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This, ULONG index)
|
|||||||
/*
|
/*
|
||||||
* make sure that the block physically exists
|
* make sure that the block physically exists
|
||||||
*/
|
*/
|
||||||
if ((This->blocksize * (index + 1)) > This->filesize.LowPart)
|
if ((This->blocksize * (index + 1)) > This->filesize.s.LowPart)
|
||||||
{
|
{
|
||||||
ULARGE_INTEGER newSize;
|
ULARGE_INTEGER newSize;
|
||||||
|
|
||||||
newSize.HighPart = 0;
|
newSize.s.HighPart = 0;
|
||||||
newSize.LowPart = This->blocksize * (index + 1);
|
newSize.s.LowPart = This->blocksize * (index + 1);
|
||||||
|
|
||||||
BIGBLOCKFILE_SetSize(This, newSize);
|
BIGBLOCKFILE_SetSize(This, newSize);
|
||||||
}
|
}
|
||||||
@ -377,7 +377,7 @@ void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock)
|
|||||||
*/
|
*/
|
||||||
void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize)
|
void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize)
|
||||||
{
|
{
|
||||||
if (This->filesize.LowPart == newSize.LowPart)
|
if (This->filesize.s.LowPart == newSize.s.LowPart)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (This->fileBased)
|
if (This->fileBased)
|
||||||
@ -396,7 +396,7 @@ void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize)
|
|||||||
/*
|
/*
|
||||||
* set the new end of file
|
* set the new end of file
|
||||||
*/
|
*/
|
||||||
SetFilePointer(This->hfile, newSize.LowPart, NULL, FILE_BEGIN);
|
SetFilePointer(This->hfile, newSize.s.LowPart, NULL, FILE_BEGIN);
|
||||||
SetEndOfFile(This->hfile);
|
SetEndOfFile(This->hfile);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -429,8 +429,8 @@ void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize)
|
|||||||
*/
|
*/
|
||||||
BIGBLOCKFILE_RemoveAllBlocks(This);
|
BIGBLOCKFILE_RemoveAllBlocks(This);
|
||||||
|
|
||||||
This->filesize.LowPart = newSize.LowPart;
|
This->filesize.s.LowPart = newSize.s.LowPart;
|
||||||
This->filesize.HighPart = newSize.HighPart;
|
This->filesize.s.HighPart = newSize.s.HighPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@ -811,8 +811,8 @@ static void * BIGBLOCKFILE_GetMappedView(
|
|||||||
newMappedPage->next = This->maplisthead->next;
|
newMappedPage->next = This->maplisthead->next;
|
||||||
This->maplisthead->next = newMappedPage;
|
This->maplisthead->next = newMappedPage;
|
||||||
|
|
||||||
if (((pagenum + 1) * PAGE_SIZE) > This->filesize.LowPart)
|
if (((pagenum + 1) * PAGE_SIZE) > This->filesize.s.LowPart)
|
||||||
numBytesToMap = This->filesize.LowPart - (pagenum * PAGE_SIZE);
|
numBytesToMap = This->filesize.s.LowPart - (pagenum * PAGE_SIZE);
|
||||||
else
|
else
|
||||||
numBytesToMap = PAGE_SIZE;
|
numBytesToMap = PAGE_SIZE;
|
||||||
|
|
||||||
|
@ -84,14 +84,14 @@ StgStreamImpl* StgStreamImpl_Construct(
|
|||||||
/*
|
/*
|
||||||
* Start the stream at the begining.
|
* Start the stream at the begining.
|
||||||
*/
|
*/
|
||||||
newStream->currentPosition.HighPart = 0;
|
newStream->currentPosition.s.HighPart = 0;
|
||||||
newStream->currentPosition.LowPart = 0;
|
newStream->currentPosition.s.LowPart = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the rest of the data.
|
* Initialize the rest of the data.
|
||||||
*/
|
*/
|
||||||
newStream->streamSize.HighPart = 0;
|
newStream->streamSize.s.HighPart = 0;
|
||||||
newStream->streamSize.LowPart = 0;
|
newStream->streamSize.s.LowPart = 0;
|
||||||
newStream->bigBlockChain = 0;
|
newStream->bigBlockChain = 0;
|
||||||
newStream->smallBlockChain = 0;
|
newStream->smallBlockChain = 0;
|
||||||
|
|
||||||
@ -272,16 +272,16 @@ void StgStreamImpl_OpenBlockChain(
|
|||||||
/*
|
/*
|
||||||
* This code supports only streams that are <32 bits in size.
|
* This code supports only streams that are <32 bits in size.
|
||||||
*/
|
*/
|
||||||
assert(This->streamSize.HighPart == 0);
|
assert(This->streamSize.s.HighPart == 0);
|
||||||
|
|
||||||
if(curProperty.startingBlock == BLOCK_END_OF_CHAIN)
|
if(curProperty.startingBlock == BLOCK_END_OF_CHAIN)
|
||||||
{
|
{
|
||||||
assert( (This->streamSize.HighPart == 0) && (This->streamSize.LowPart == 0) );
|
assert( (This->streamSize.s.HighPart == 0) && (This->streamSize.s.LowPart == 0) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( (This->streamSize.HighPart == 0) &&
|
if ( (This->streamSize.s.HighPart == 0) &&
|
||||||
(This->streamSize.LowPart < LIMIT_TO_USE_SMALL_BLOCK) )
|
(This->streamSize.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK) )
|
||||||
{
|
{
|
||||||
This->smallBlockChain = SmallBlockChainStream_Construct(
|
This->smallBlockChain = SmallBlockChainStream_Construct(
|
||||||
This->parentStorage->ancestorStorage,
|
This->parentStorage->ancestorStorage,
|
||||||
@ -332,7 +332,7 @@ HRESULT WINAPI StgStreamImpl_Read(
|
|||||||
* Using the known size of the stream, calculate the number of bytes
|
* Using the known size of the stream, calculate the number of bytes
|
||||||
* to read from the block chain
|
* to read from the block chain
|
||||||
*/
|
*/
|
||||||
bytesToReadFromBuffer = MIN( This->streamSize.LowPart - This->currentPosition.LowPart, cb);
|
bytesToReadFromBuffer = MIN( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Depending on the type of chain that was opened when the stream was constructed,
|
* Depending on the type of chain that was opened when the stream was constructed,
|
||||||
@ -375,7 +375,7 @@ HRESULT WINAPI StgStreamImpl_Read(
|
|||||||
/*
|
/*
|
||||||
* Advance the pointer for the number of positions read.
|
* Advance the pointer for the number of positions read.
|
||||||
*/
|
*/
|
||||||
This->currentPosition.LowPart += *pcbRead;
|
This->currentPosition.s.LowPart += *pcbRead;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The function returns S_OK if the buffer was filled completely
|
* The function returns S_OK if the buffer was filled completely
|
||||||
@ -430,14 +430,14 @@ HRESULT WINAPI StgStreamImpl_Write(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newSize.HighPart = 0;
|
newSize.s.HighPart = 0;
|
||||||
newSize.LowPart = This->currentPosition.LowPart + cb;
|
newSize.s.LowPart = This->currentPosition.s.LowPart + cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify if we need to grow the stream
|
* Verify if we need to grow the stream
|
||||||
*/
|
*/
|
||||||
if (newSize.LowPart > This->streamSize.LowPart)
|
if (newSize.s.LowPart > This->streamSize.s.LowPart)
|
||||||
{
|
{
|
||||||
/* grow stream */
|
/* grow stream */
|
||||||
IStream_SetSize(iface, newSize);
|
IStream_SetSize(iface, newSize);
|
||||||
@ -470,7 +470,7 @@ HRESULT WINAPI StgStreamImpl_Write(
|
|||||||
/*
|
/*
|
||||||
* Advance the position pointer for the number of positions written.
|
* Advance the position pointer for the number of positions written.
|
||||||
*/
|
*/
|
||||||
This->currentPosition.LowPart += *pcbWritten;
|
This->currentPosition.s.LowPart += *pcbWritten;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -494,7 +494,7 @@ HRESULT WINAPI StgStreamImpl_Seek(
|
|||||||
ULARGE_INTEGER newPosition;
|
ULARGE_INTEGER newPosition;
|
||||||
|
|
||||||
TRACE("(%p, %ld, %ld, %p)\n",
|
TRACE("(%p, %ld, %ld, %p)\n",
|
||||||
iface, dlibMove.LowPart, dwOrigin, plibNewPosition);
|
iface, dlibMove.s.LowPart, dwOrigin, plibNewPosition);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The caller is allowed to pass in NULL as the new position return value.
|
* The caller is allowed to pass in NULL as the new position return value.
|
||||||
@ -513,8 +513,8 @@ HRESULT WINAPI StgStreamImpl_Seek(
|
|||||||
switch (dwOrigin)
|
switch (dwOrigin)
|
||||||
{
|
{
|
||||||
case STREAM_SEEK_SET:
|
case STREAM_SEEK_SET:
|
||||||
plibNewPosition->HighPart = 0;
|
plibNewPosition->s.HighPart = 0;
|
||||||
plibNewPosition->LowPart = 0;
|
plibNewPosition->s.LowPart = 0;
|
||||||
break;
|
break;
|
||||||
case STREAM_SEEK_CUR:
|
case STREAM_SEEK_CUR:
|
||||||
*plibNewPosition = This->currentPosition;
|
*plibNewPosition = This->currentPosition;
|
||||||
@ -529,13 +529,13 @@ HRESULT WINAPI StgStreamImpl_Seek(
|
|||||||
/*
|
/*
|
||||||
* We don't support files with offsets of 64 bits.
|
* We don't support files with offsets of 64 bits.
|
||||||
*/
|
*/
|
||||||
assert(dlibMove.HighPart == 0);
|
assert(dlibMove.s.HighPart == 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if we end-up before the beginning of the file. That should trigger an
|
* Check if we end-up before the beginning of the file. That should trigger an
|
||||||
* error.
|
* error.
|
||||||
*/
|
*/
|
||||||
if ( (dlibMove.LowPart<0) && (plibNewPosition->LowPart < (ULONG)(-dlibMove.LowPart)) )
|
if ( (dlibMove.s.LowPart<0) && (plibNewPosition->s.LowPart < (ULONG)(-dlibMove.s.LowPart)) )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* I don't know what error to send there.
|
* I don't know what error to send there.
|
||||||
@ -548,7 +548,7 @@ HRESULT WINAPI StgStreamImpl_Seek(
|
|||||||
* If the file pointer ends-up after the end of the stream, the next Write operation will
|
* If the file pointer ends-up after the end of the stream, the next Write operation will
|
||||||
* make the file larger. This is how it is documented.
|
* make the file larger. This is how it is documented.
|
||||||
*/
|
*/
|
||||||
plibNewPosition->LowPart += dlibMove.LowPart;
|
plibNewPosition->s.LowPart += dlibMove.s.LowPart;
|
||||||
This->currentPosition = *plibNewPosition;
|
This->currentPosition = *plibNewPosition;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -572,15 +572,15 @@ HRESULT WINAPI StgStreamImpl_SetSize(
|
|||||||
StgProperty curProperty;
|
StgProperty curProperty;
|
||||||
BOOL Success;
|
BOOL Success;
|
||||||
|
|
||||||
TRACE("(%p, %ld)\n", iface, libNewSize.LowPart);
|
TRACE("(%p, %ld)\n", iface, libNewSize.s.LowPart);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As documented.
|
* As documented.
|
||||||
*/
|
*/
|
||||||
if (libNewSize.HighPart != 0)
|
if (libNewSize.s.HighPart != 0)
|
||||||
return STG_E_INVALIDFUNCTION;
|
return STG_E_INVALIDFUNCTION;
|
||||||
|
|
||||||
if (This->streamSize.LowPart == libNewSize.LowPart)
|
if (This->streamSize.s.LowPart == libNewSize.s.LowPart)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -588,7 +588,7 @@ HRESULT WINAPI StgStreamImpl_SetSize(
|
|||||||
*/
|
*/
|
||||||
if ((This->smallBlockChain == 0) && (This->bigBlockChain == 0))
|
if ((This->smallBlockChain == 0) && (This->bigBlockChain == 0))
|
||||||
{
|
{
|
||||||
if (libNewSize.LowPart < LIMIT_TO_USE_SMALL_BLOCK)
|
if (libNewSize.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK)
|
||||||
{
|
{
|
||||||
This->smallBlockChain = SmallBlockChainStream_Construct(
|
This->smallBlockChain = SmallBlockChainStream_Construct(
|
||||||
This->parentStorage->ancestorStorage,
|
This->parentStorage->ancestorStorage,
|
||||||
@ -613,9 +613,9 @@ HRESULT WINAPI StgStreamImpl_SetSize(
|
|||||||
* Determine if we have to switch from small to big blocks or vice versa
|
* Determine if we have to switch from small to big blocks or vice versa
|
||||||
*/
|
*/
|
||||||
if ( (This->smallBlockChain!=0) &&
|
if ( (This->smallBlockChain!=0) &&
|
||||||
(curProperty.size.LowPart < LIMIT_TO_USE_SMALL_BLOCK) )
|
(curProperty.size.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK) )
|
||||||
{
|
{
|
||||||
if (libNewSize.LowPart >= LIMIT_TO_USE_SMALL_BLOCK)
|
if (libNewSize.s.LowPart >= LIMIT_TO_USE_SMALL_BLOCK)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Transform the small block chain into a big block chain
|
* Transform the small block chain into a big block chain
|
||||||
@ -642,8 +642,8 @@ HRESULT WINAPI StgStreamImpl_SetSize(
|
|||||||
This->ownerProperty,
|
This->ownerProperty,
|
||||||
&curProperty);
|
&curProperty);
|
||||||
|
|
||||||
curProperty.size.HighPart = libNewSize.HighPart;
|
curProperty.size.s.HighPart = libNewSize.s.HighPart;
|
||||||
curProperty.size.LowPart = libNewSize.LowPart;
|
curProperty.size.s.LowPart = libNewSize.s.LowPart;
|
||||||
|
|
||||||
if (Success)
|
if (Success)
|
||||||
{
|
{
|
||||||
@ -678,7 +678,7 @@ HRESULT WINAPI StgStreamImpl_CopyTo(
|
|||||||
ULARGE_INTEGER totalBytesWritten;
|
ULARGE_INTEGER totalBytesWritten;
|
||||||
|
|
||||||
TRACE("(%p, %p, %ld, %p, %p)\n",
|
TRACE("(%p, %p, %ld, %p, %p)\n",
|
||||||
iface, pstm, cb.LowPart, pcbRead, pcbWritten);
|
iface, pstm, cb.s.LowPart, pcbRead, pcbWritten);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sanity check
|
* Sanity check
|
||||||
@ -686,28 +686,28 @@ HRESULT WINAPI StgStreamImpl_CopyTo(
|
|||||||
if ( pstm == 0 )
|
if ( pstm == 0 )
|
||||||
return STG_E_INVALIDPOINTER;
|
return STG_E_INVALIDPOINTER;
|
||||||
|
|
||||||
totalBytesRead.LowPart = totalBytesRead.HighPart = 0;
|
totalBytesRead.s.LowPart = totalBytesRead.s.HighPart = 0;
|
||||||
totalBytesWritten.LowPart = totalBytesWritten.HighPart = 0;
|
totalBytesWritten.s.LowPart = totalBytesWritten.s.HighPart = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* use stack to store data temporarly
|
* use stack to store data temporarly
|
||||||
* there is surely more performant way of doing it, for now this basic
|
* there is surely more performant way of doing it, for now this basic
|
||||||
* implementation will do the job
|
* implementation will do the job
|
||||||
*/
|
*/
|
||||||
while ( cb.LowPart > 0 )
|
while ( cb.s.LowPart > 0 )
|
||||||
{
|
{
|
||||||
if ( cb.LowPart >= 128 )
|
if ( cb.s.LowPart >= 128 )
|
||||||
copySize = 128;
|
copySize = 128;
|
||||||
else
|
else
|
||||||
copySize = cb.LowPart;
|
copySize = cb.s.LowPart;
|
||||||
|
|
||||||
IStream_Read(iface, tmpBuffer, copySize, &bytesRead);
|
IStream_Read(iface, tmpBuffer, copySize, &bytesRead);
|
||||||
|
|
||||||
totalBytesRead.LowPart += bytesRead;
|
totalBytesRead.s.LowPart += bytesRead;
|
||||||
|
|
||||||
IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten);
|
IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten);
|
||||||
|
|
||||||
totalBytesWritten.LowPart += bytesWritten;
|
totalBytesWritten.s.LowPart += bytesWritten;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that read & write operations were succesfull
|
* Check that read & write operations were succesfull
|
||||||
@ -719,9 +719,9 @@ HRESULT WINAPI StgStreamImpl_CopyTo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bytesRead!=copySize)
|
if (bytesRead!=copySize)
|
||||||
cb.LowPart = 0;
|
cb.s.LowPart = 0;
|
||||||
else
|
else
|
||||||
cb.LowPart -= bytesRead;
|
cb.s.LowPart -= bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -729,14 +729,14 @@ HRESULT WINAPI StgStreamImpl_CopyTo(
|
|||||||
*/
|
*/
|
||||||
if (pcbRead)
|
if (pcbRead)
|
||||||
{
|
{
|
||||||
pcbRead->LowPart = totalBytesRead.LowPart;
|
pcbRead->s.LowPart = totalBytesRead.s.LowPart;
|
||||||
pcbRead->HighPart = totalBytesRead.HighPart;
|
pcbRead->s.HighPart = totalBytesRead.s.HighPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcbWritten)
|
if (pcbWritten)
|
||||||
{
|
{
|
||||||
pcbWritten->LowPart = totalBytesWritten.LowPart;
|
pcbWritten->s.LowPart = totalBytesWritten.s.LowPart;
|
||||||
pcbWritten->HighPart = totalBytesWritten.HighPart;
|
pcbWritten->s.HighPart = totalBytesWritten.s.HighPart;
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -732,7 +732,7 @@ HRESULT WINAPI IStream16_fnSeek(
|
|||||||
IStream16* iface,LARGE_INTEGER offset,DWORD whence,ULARGE_INTEGER *newpos
|
IStream16* iface,LARGE_INTEGER offset,DWORD whence,ULARGE_INTEGER *newpos
|
||||||
) {
|
) {
|
||||||
ICOM_THIS(IStream16Impl,iface);
|
ICOM_THIS(IStream16Impl,iface);
|
||||||
TRACE_(relay)("(%p)->([%ld.%ld],%ld,%p)\n",This,offset.HighPart,offset.LowPart,whence,newpos);
|
TRACE_(relay)("(%p)->([%ld.%ld],%ld,%p)\n",This,offset.s.HighPart,offset.s.LowPart,whence,newpos);
|
||||||
|
|
||||||
switch (whence) {
|
switch (whence) {
|
||||||
/* unix SEEK_xx should be the same as win95 ones */
|
/* unix SEEK_xx should be the same as win95 ones */
|
||||||
@ -740,31 +740,31 @@ HRESULT WINAPI IStream16_fnSeek(
|
|||||||
/* offset must be ==0 (<0 is invalid, and >0 cannot be handled
|
/* offset must be ==0 (<0 is invalid, and >0 cannot be handled
|
||||||
* right now.
|
* right now.
|
||||||
*/
|
*/
|
||||||
assert(offset.HighPart==0);
|
assert(offset.s.HighPart==0);
|
||||||
This->offset.HighPart = offset.HighPart;
|
This->offset.s.HighPart = offset.s.HighPart;
|
||||||
This->offset.LowPart = offset.LowPart;
|
This->offset.s.LowPart = offset.s.LowPart;
|
||||||
break;
|
break;
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
if (offset.HighPart < 0) {
|
if (offset.s.HighPart < 0) {
|
||||||
/* FIXME: is this negation correct ? */
|
/* FIXME: is this negation correct ? */
|
||||||
offset.HighPart = -offset.HighPart;
|
offset.s.HighPart = -offset.s.HighPart;
|
||||||
offset.LowPart = (0xffffffff ^ offset.LowPart)+1;
|
offset.s.LowPart = (0xffffffff ^ offset.s.LowPart)+1;
|
||||||
|
|
||||||
assert(offset.HighPart==0);
|
assert(offset.s.HighPart==0);
|
||||||
assert(This->offset.LowPart >= offset.LowPart);
|
assert(This->offset.s.LowPart >= offset.s.LowPart);
|
||||||
This->offset.LowPart -= offset.LowPart;
|
This->offset.s.LowPart -= offset.s.LowPart;
|
||||||
} else {
|
} else {
|
||||||
assert(offset.HighPart==0);
|
assert(offset.s.HighPart==0);
|
||||||
This->offset.LowPart+= offset.LowPart;
|
This->offset.s.LowPart+= offset.s.LowPart;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
assert(offset.HighPart==0);
|
assert(offset.s.HighPart==0);
|
||||||
This->offset.LowPart = This->stde.pps_size-offset.LowPart;
|
This->offset.s.LowPart = This->stde.pps_size-offset.s.LowPart;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (This->offset.LowPart>This->stde.pps_size)
|
if (This->offset.s.LowPart>This->stde.pps_size)
|
||||||
This->offset.LowPart=This->stde.pps_size;
|
This->offset.s.LowPart=This->stde.pps_size;
|
||||||
if (newpos) *newpos = This->offset;
|
if (newpos) *newpos = This->offset;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -784,11 +784,11 @@ HRESULT WINAPI IStream16_fnRead(
|
|||||||
if (!pcbRead) bytesread=&xxread;
|
if (!pcbRead) bytesread=&xxread;
|
||||||
*bytesread = 0;
|
*bytesread = 0;
|
||||||
|
|
||||||
if (cb>This->stde.pps_size-This->offset.LowPart)
|
if (cb>This->stde.pps_size-This->offset.s.LowPart)
|
||||||
cb=This->stde.pps_size-This->offset.LowPart;
|
cb=This->stde.pps_size-This->offset.s.LowPart;
|
||||||
if (This->stde.pps_size < 0x1000) {
|
if (This->stde.pps_size < 0x1000) {
|
||||||
/* use small block reader */
|
/* use small block reader */
|
||||||
blocknr = STORAGE_get_nth_next_small_blocknr(This->hf,This->stde.pps_sb,This->offset.LowPart/SMALLSIZE);
|
blocknr = STORAGE_get_nth_next_small_blocknr(This->hf,This->stde.pps_sb,This->offset.s.LowPart/SMALLSIZE);
|
||||||
while (cb) {
|
while (cb) {
|
||||||
int cc;
|
int cc;
|
||||||
|
|
||||||
@ -797,10 +797,10 @@ HRESULT WINAPI IStream16_fnRead(
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
cc = cb;
|
cc = cb;
|
||||||
if (cc>SMALLSIZE-(This->offset.LowPart&(SMALLSIZE-1)))
|
if (cc>SMALLSIZE-(This->offset.s.LowPart&(SMALLSIZE-1)))
|
||||||
cc=SMALLSIZE-(This->offset.LowPart&(SMALLSIZE-1));
|
cc=SMALLSIZE-(This->offset.s.LowPart&(SMALLSIZE-1));
|
||||||
memcpy((LPBYTE)pv,block+(This->offset.LowPart&(SMALLSIZE-1)),cc);
|
memcpy((LPBYTE)pv,block+(This->offset.s.LowPart&(SMALLSIZE-1)),cc);
|
||||||
This->offset.LowPart+=cc;
|
This->offset.s.LowPart+=cc;
|
||||||
(LPBYTE)pv+=cc;
|
(LPBYTE)pv+=cc;
|
||||||
*bytesread+=cc;
|
*bytesread+=cc;
|
||||||
cb-=cc;
|
cb-=cc;
|
||||||
@ -808,7 +808,7 @@ HRESULT WINAPI IStream16_fnRead(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* use big block reader */
|
/* use big block reader */
|
||||||
blocknr = STORAGE_get_nth_next_big_blocknr(This->hf,This->stde.pps_sb,This->offset.LowPart/BIGSIZE);
|
blocknr = STORAGE_get_nth_next_big_blocknr(This->hf,This->stde.pps_sb,This->offset.s.LowPart/BIGSIZE);
|
||||||
while (cb) {
|
while (cb) {
|
||||||
int cc;
|
int cc;
|
||||||
|
|
||||||
@ -817,10 +817,10 @@ HRESULT WINAPI IStream16_fnRead(
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
cc = cb;
|
cc = cb;
|
||||||
if (cc>BIGSIZE-(This->offset.LowPart&(BIGSIZE-1)))
|
if (cc>BIGSIZE-(This->offset.s.LowPart&(BIGSIZE-1)))
|
||||||
cc=BIGSIZE-(This->offset.LowPart&(BIGSIZE-1));
|
cc=BIGSIZE-(This->offset.s.LowPart&(BIGSIZE-1));
|
||||||
memcpy((LPBYTE)pv,block+(This->offset.LowPart&(BIGSIZE-1)),cc);
|
memcpy((LPBYTE)pv,block+(This->offset.s.LowPart&(BIGSIZE-1)),cc);
|
||||||
This->offset.LowPart+=cc;
|
This->offset.s.LowPart+=cc;
|
||||||
(LPBYTE)pv+=cc;
|
(LPBYTE)pv+=cc;
|
||||||
*bytesread+=cc;
|
*bytesread+=cc;
|
||||||
cb-=cc;
|
cb-=cc;
|
||||||
@ -847,7 +847,7 @@ HRESULT WINAPI IStream16_fnWrite(
|
|||||||
|
|
||||||
TRACE_(relay)("(%p)->(%p,%ld,%p)\n",This,pv,cb,pcbWrite);
|
TRACE_(relay)("(%p)->(%p,%ld,%p)\n",This,pv,cb,pcbWrite);
|
||||||
/* do we need to junk some blocks? */
|
/* do we need to junk some blocks? */
|
||||||
newsize = This->offset.LowPart+cb;
|
newsize = This->offset.s.LowPart+cb;
|
||||||
oldsize = This->stde.pps_size;
|
oldsize = This->stde.pps_size;
|
||||||
if (newsize < oldsize) {
|
if (newsize < oldsize) {
|
||||||
if (oldsize < 0x1000) {
|
if (oldsize < 0x1000) {
|
||||||
@ -1033,7 +1033,7 @@ HRESULT WINAPI IStream16_fnWrite(
|
|||||||
|
|
||||||
/* finally the write pass */
|
/* finally the write pass */
|
||||||
if (This->stde.pps_size < 0x1000) {
|
if (This->stde.pps_size < 0x1000) {
|
||||||
blocknr = STORAGE_get_nth_next_small_blocknr(hf,This->stde.pps_sb,This->offset.LowPart/SMALLSIZE);
|
blocknr = STORAGE_get_nth_next_small_blocknr(hf,This->stde.pps_sb,This->offset.s.LowPart/SMALLSIZE);
|
||||||
assert(blocknr>=0);
|
assert(blocknr>=0);
|
||||||
while (cb>0) {
|
while (cb>0) {
|
||||||
/* we ensured that it is allocated above */
|
/* we ensured that it is allocated above */
|
||||||
@ -1044,10 +1044,10 @@ HRESULT WINAPI IStream16_fnWrite(
|
|||||||
if (!STORAGE_get_small_block(hf,blocknr,block))
|
if (!STORAGE_get_small_block(hf,blocknr,block))
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
cc = SMALLSIZE-(This->offset.LowPart&(SMALLSIZE-1));
|
cc = SMALLSIZE-(This->offset.s.LowPart&(SMALLSIZE-1));
|
||||||
if (cc>cb)
|
if (cc>cb)
|
||||||
cc=cb;
|
cc=cb;
|
||||||
memcpy( ((LPBYTE)block)+(This->offset.LowPart&(SMALLSIZE-1)),
|
memcpy( ((LPBYTE)block)+(This->offset.s.LowPart&(SMALLSIZE-1)),
|
||||||
(LPBYTE)((char *) pv+curoffset),
|
(LPBYTE)((char *) pv+curoffset),
|
||||||
cc
|
cc
|
||||||
);
|
);
|
||||||
@ -1056,12 +1056,12 @@ HRESULT WINAPI IStream16_fnWrite(
|
|||||||
cb -= cc;
|
cb -= cc;
|
||||||
curoffset += cc;
|
curoffset += cc;
|
||||||
(LPBYTE)pv += cc;
|
(LPBYTE)pv += cc;
|
||||||
This->offset.LowPart += cc;
|
This->offset.s.LowPart += cc;
|
||||||
*byteswritten += cc;
|
*byteswritten += cc;
|
||||||
blocknr = STORAGE_get_next_small_blocknr(hf,blocknr);
|
blocknr = STORAGE_get_next_small_blocknr(hf,blocknr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
blocknr = STORAGE_get_nth_next_big_blocknr(hf,This->stde.pps_sb,This->offset.LowPart/BIGSIZE);
|
blocknr = STORAGE_get_nth_next_big_blocknr(hf,This->stde.pps_sb,This->offset.s.LowPart/BIGSIZE);
|
||||||
assert(blocknr>=0);
|
assert(blocknr>=0);
|
||||||
while (cb>0) {
|
while (cb>0) {
|
||||||
/* we ensured that it is allocated above, so it better is */
|
/* we ensured that it is allocated above, so it better is */
|
||||||
@ -1072,10 +1072,10 @@ HRESULT WINAPI IStream16_fnWrite(
|
|||||||
if (!STORAGE_get_big_block(hf,blocknr,block))
|
if (!STORAGE_get_big_block(hf,blocknr,block))
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
cc = BIGSIZE-(This->offset.LowPart&(BIGSIZE-1));
|
cc = BIGSIZE-(This->offset.s.LowPart&(BIGSIZE-1));
|
||||||
if (cc>cb)
|
if (cc>cb)
|
||||||
cc=cb;
|
cc=cb;
|
||||||
memcpy( ((LPBYTE)block)+(This->offset.LowPart&(BIGSIZE-1)),
|
memcpy( ((LPBYTE)block)+(This->offset.s.LowPart&(BIGSIZE-1)),
|
||||||
(LPBYTE)((char *) pv+curoffset),
|
(LPBYTE)((char *) pv+curoffset),
|
||||||
cc
|
cc
|
||||||
);
|
);
|
||||||
@ -1084,7 +1084,7 @@ HRESULT WINAPI IStream16_fnWrite(
|
|||||||
cb -= cc;
|
cb -= cc;
|
||||||
curoffset += cc;
|
curoffset += cc;
|
||||||
(LPBYTE)pv += cc;
|
(LPBYTE)pv += cc;
|
||||||
This->offset.LowPart += cc;
|
This->offset.s.LowPart += cc;
|
||||||
*byteswritten += cc;
|
*byteswritten += cc;
|
||||||
blocknr = STORAGE_get_next_big_blocknr(hf,blocknr);
|
blocknr = STORAGE_get_next_big_blocknr(hf,blocknr);
|
||||||
}
|
}
|
||||||
@ -1272,7 +1272,7 @@ HRESULT WINAPI IStorage16_fnStat(
|
|||||||
);
|
);
|
||||||
pstatstg->pwcsName=(LPOLESTR16)SEGPTR_GET(SEGPTR_STRDUP_WtoA(This->stde.pps_rawname));
|
pstatstg->pwcsName=(LPOLESTR16)SEGPTR_GET(SEGPTR_STRDUP_WtoA(This->stde.pps_rawname));
|
||||||
pstatstg->type = This->stde.pps_type;
|
pstatstg->type = This->stde.pps_type;
|
||||||
pstatstg->cbSize.LowPart = This->stde.pps_size;
|
pstatstg->cbSize.s.LowPart = This->stde.pps_size;
|
||||||
pstatstg->mtime = This->stde.pps_ft1; /* FIXME */ /* why? */
|
pstatstg->mtime = This->stde.pps_ft1; /* FIXME */ /* why? */
|
||||||
pstatstg->atime = This->stde.pps_ft2; /* FIXME */
|
pstatstg->atime = This->stde.pps_ft2; /* FIXME */
|
||||||
pstatstg->ctime = This->stde.pps_ft2; /* FIXME */
|
pstatstg->ctime = This->stde.pps_ft2; /* FIXME */
|
||||||
@ -1395,8 +1395,8 @@ HRESULT WINAPI IStorage16_fnCreateStream(
|
|||||||
lpstr = (IStream16Impl*)PTR_SEG_TO_LIN(*ppstm);
|
lpstr = (IStream16Impl*)PTR_SEG_TO_LIN(*ppstm);
|
||||||
DuplicateHandle( GetCurrentProcess(), This->hf, GetCurrentProcess(),
|
DuplicateHandle( GetCurrentProcess(), This->hf, GetCurrentProcess(),
|
||||||
&lpstr->hf, 0, TRUE, DUPLICATE_SAME_ACCESS );
|
&lpstr->hf, 0, TRUE, DUPLICATE_SAME_ACCESS );
|
||||||
lpstr->offset.LowPart = 0;
|
lpstr->offset.s.LowPart = 0;
|
||||||
lpstr->offset.HighPart = 0;
|
lpstr->offset.s.HighPart = 0;
|
||||||
|
|
||||||
ppsent=STORAGE_get_free_pps_entry(lpstr->hf);
|
ppsent=STORAGE_get_free_pps_entry(lpstr->hf);
|
||||||
if (ppsent<0)
|
if (ppsent<0)
|
||||||
@ -1494,8 +1494,8 @@ HRESULT WINAPI IStorage16_fnOpenStream(
|
|||||||
IStream16_fnRelease((IStream16*)lpstr);
|
IStream16_fnRelease((IStream16*)lpstr);
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
lpstr->offset.LowPart = 0;
|
lpstr->offset.s.LowPart = 0;
|
||||||
lpstr->offset.HighPart = 0;
|
lpstr->offset.s.HighPart = 0;
|
||||||
lpstr->ppsent = newpps;
|
lpstr->ppsent = newpps;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
140
ole/storage32.c
140
ole/storage32.c
@ -630,8 +630,8 @@ HRESULT WINAPI StorageBaseImpl_RenameElement(
|
|||||||
|
|
||||||
renamedProperty.propertyType = currentProperty.propertyType;
|
renamedProperty.propertyType = currentProperty.propertyType;
|
||||||
renamedProperty.startingBlock = currentProperty.startingBlock;
|
renamedProperty.startingBlock = currentProperty.startingBlock;
|
||||||
renamedProperty.size.LowPart = currentProperty.size.LowPart;
|
renamedProperty.size.s.LowPart = currentProperty.size.s.LowPart;
|
||||||
renamedProperty.size.HighPart = currentProperty.size.HighPart;
|
renamedProperty.size.s.HighPart = currentProperty.size.s.HighPart;
|
||||||
|
|
||||||
renamedProperty.previousProperty = PROPERTY_NULL;
|
renamedProperty.previousProperty = PROPERTY_NULL;
|
||||||
renamedProperty.nextProperty = PROPERTY_NULL;
|
renamedProperty.nextProperty = PROPERTY_NULL;
|
||||||
@ -800,8 +800,8 @@ HRESULT WINAPI StorageBaseImpl_CreateStream(
|
|||||||
|
|
||||||
newStreamProperty.propertyType = PROPTYPE_STREAM;
|
newStreamProperty.propertyType = PROPTYPE_STREAM;
|
||||||
newStreamProperty.startingBlock = BLOCK_END_OF_CHAIN;
|
newStreamProperty.startingBlock = BLOCK_END_OF_CHAIN;
|
||||||
newStreamProperty.size.LowPart = 0;
|
newStreamProperty.size.s.LowPart = 0;
|
||||||
newStreamProperty.size.HighPart = 0;
|
newStreamProperty.size.s.HighPart = 0;
|
||||||
|
|
||||||
newStreamProperty.previousProperty = PROPERTY_NULL;
|
newStreamProperty.previousProperty = PROPERTY_NULL;
|
||||||
newStreamProperty.nextProperty = PROPERTY_NULL;
|
newStreamProperty.nextProperty = PROPERTY_NULL;
|
||||||
@ -985,8 +985,8 @@ HRESULT WINAPI StorageImpl_CreateStorage(
|
|||||||
|
|
||||||
newProperty.propertyType = PROPTYPE_STORAGE;
|
newProperty.propertyType = PROPTYPE_STORAGE;
|
||||||
newProperty.startingBlock = BLOCK_END_OF_CHAIN;
|
newProperty.startingBlock = BLOCK_END_OF_CHAIN;
|
||||||
newProperty.size.LowPart = 0;
|
newProperty.size.s.LowPart = 0;
|
||||||
newProperty.size.HighPart = 0;
|
newProperty.size.s.HighPart = 0;
|
||||||
|
|
||||||
newProperty.previousProperty = PROPERTY_NULL;
|
newProperty.previousProperty = PROPERTY_NULL;
|
||||||
newProperty.nextProperty = PROPERTY_NULL;
|
newProperty.nextProperty = PROPERTY_NULL;
|
||||||
@ -1107,8 +1107,8 @@ static ULONG getFreeProperty(
|
|||||||
/*
|
/*
|
||||||
* initialize the size used by the property stream
|
* initialize the size used by the property stream
|
||||||
*/
|
*/
|
||||||
newSize.HighPart = 0;
|
newSize.s.HighPart = 0;
|
||||||
newSize.LowPart = storage->bigBlockSize * blockCount;
|
newSize.s.LowPart = storage->bigBlockSize * blockCount;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add a property block to the property chain
|
* add a property block to the property chain
|
||||||
@ -1699,8 +1699,8 @@ static HRESULT deleteStreamProperty(
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ULARGE_INTEGER size;
|
ULARGE_INTEGER size;
|
||||||
|
|
||||||
size.HighPart = 0;
|
size.s.HighPart = 0;
|
||||||
size.LowPart = 0;
|
size.s.LowPart = 0;
|
||||||
|
|
||||||
hr = StorageBaseImpl_OpenStream(
|
hr = StorageBaseImpl_OpenStream(
|
||||||
(IStorage*)parentStorage,
|
(IStorage*)parentStorage,
|
||||||
@ -2094,8 +2094,8 @@ HRESULT StorageImpl_Construct(
|
|||||||
/*
|
/*
|
||||||
* Add one block for the big block depot and one block for the properties
|
* Add one block for the big block depot and one block for the properties
|
||||||
*/
|
*/
|
||||||
size.HighPart = 0;
|
size.s.HighPart = 0;
|
||||||
size.LowPart = This->bigBlockSize * 3;
|
size.s.LowPart = This->bigBlockSize * 3;
|
||||||
BIGBLOCKFILE_SetSize(This->bigBlockFile, size);
|
BIGBLOCKFILE_SetSize(This->bigBlockFile, size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2161,8 +2161,8 @@ HRESULT StorageImpl_Construct(
|
|||||||
rootProp.nextProperty = PROPERTY_NULL;
|
rootProp.nextProperty = PROPERTY_NULL;
|
||||||
rootProp.dirProperty = PROPERTY_NULL;
|
rootProp.dirProperty = PROPERTY_NULL;
|
||||||
rootProp.startingBlock = BLOCK_END_OF_CHAIN;
|
rootProp.startingBlock = BLOCK_END_OF_CHAIN;
|
||||||
rootProp.size.HighPart = 0;
|
rootProp.size.s.HighPart = 0;
|
||||||
rootProp.size.LowPart = 0;
|
rootProp.size.s.LowPart = 0;
|
||||||
|
|
||||||
StorageImpl_WriteProperty(This, 0, &rootProp);
|
StorageImpl_WriteProperty(This, 0, &rootProp);
|
||||||
}
|
}
|
||||||
@ -2924,8 +2924,8 @@ BOOL StorageImpl_ReadProperty(
|
|||||||
BOOL readSucessful;
|
BOOL readSucessful;
|
||||||
ULONG bytesRead;
|
ULONG bytesRead;
|
||||||
|
|
||||||
offsetInPropSet.HighPart = 0;
|
offsetInPropSet.s.HighPart = 0;
|
||||||
offsetInPropSet.LowPart = index * PROPSET_BLOCK_SIZE;
|
offsetInPropSet.s.LowPart = index * PROPSET_BLOCK_SIZE;
|
||||||
|
|
||||||
readSucessful = BlockChainStream_ReadAt(
|
readSucessful = BlockChainStream_ReadAt(
|
||||||
This->rootBlockChain,
|
This->rootBlockChain,
|
||||||
@ -2997,9 +2997,9 @@ BOOL StorageImpl_ReadProperty(
|
|||||||
StorageUtl_ReadDWord(
|
StorageUtl_ReadDWord(
|
||||||
currentProperty,
|
currentProperty,
|
||||||
OFFSET_PS_SIZE,
|
OFFSET_PS_SIZE,
|
||||||
&buffer->size.LowPart);
|
&buffer->size.s.LowPart);
|
||||||
|
|
||||||
buffer->size.HighPart = 0;
|
buffer->size.s.HighPart = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return readSucessful;
|
return readSucessful;
|
||||||
@ -3018,8 +3018,8 @@ BOOL StorageImpl_WriteProperty(
|
|||||||
BOOL writeSucessful;
|
BOOL writeSucessful;
|
||||||
ULONG bytesWritten;
|
ULONG bytesWritten;
|
||||||
|
|
||||||
offsetInPropSet.HighPart = 0;
|
offsetInPropSet.s.HighPart = 0;
|
||||||
offsetInPropSet.LowPart = index * PROPSET_BLOCK_SIZE;
|
offsetInPropSet.s.LowPart = index * PROPSET_BLOCK_SIZE;
|
||||||
|
|
||||||
memset(currentProperty, 0, PROPSET_BLOCK_SIZE);
|
memset(currentProperty, 0, PROPSET_BLOCK_SIZE);
|
||||||
|
|
||||||
@ -3088,7 +3088,7 @@ BOOL StorageImpl_WriteProperty(
|
|||||||
StorageUtl_WriteDWord(
|
StorageUtl_WriteDWord(
|
||||||
currentProperty,
|
currentProperty,
|
||||||
OFFSET_PS_SIZE,
|
OFFSET_PS_SIZE,
|
||||||
buffer->size.LowPart);
|
buffer->size.s.LowPart);
|
||||||
|
|
||||||
writeSucessful = BlockChainStream_WriteAt(This->rootBlockChain,
|
writeSucessful = BlockChainStream_WriteAt(This->rootBlockChain,
|
||||||
offsetInPropSet,
|
offsetInPropSet,
|
||||||
@ -3200,8 +3200,8 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
|
|||||||
* Copy the contents of the small block chain to the big block chain
|
* Copy the contents of the small block chain to the big block chain
|
||||||
* by small block size increments.
|
* by small block size increments.
|
||||||
*/
|
*/
|
||||||
offset.LowPart = 0;
|
offset.s.LowPart = 0;
|
||||||
offset.HighPart = 0;
|
offset.s.HighPart = 0;
|
||||||
cbTotalRead = 0;
|
cbTotalRead = 0;
|
||||||
cbTotalWritten = 0;
|
cbTotalWritten = 0;
|
||||||
|
|
||||||
@ -3222,7 +3222,7 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
|
|||||||
&cbWritten);
|
&cbWritten);
|
||||||
cbTotalWritten += cbWritten;
|
cbTotalWritten += cbWritten;
|
||||||
|
|
||||||
offset.LowPart += This->smallBlockSize;
|
offset.s.LowPart += This->smallBlockSize;
|
||||||
|
|
||||||
} while (successRead && successWrite);
|
} while (successRead && successWrite);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
@ -3233,8 +3233,8 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
|
|||||||
* Destroy the small block chain.
|
* Destroy the small block chain.
|
||||||
*/
|
*/
|
||||||
propertyIndex = (*ppsbChain)->ownerPropertyIndex;
|
propertyIndex = (*ppsbChain)->ownerPropertyIndex;
|
||||||
size.HighPart = 0;
|
size.s.HighPart = 0;
|
||||||
size.LowPart = 0;
|
size.s.LowPart = 0;
|
||||||
SmallBlockChainStream_SetSize(*ppsbChain, size);
|
SmallBlockChainStream_SetSize(*ppsbChain, size);
|
||||||
SmallBlockChainStream_Destroy(*ppsbChain);
|
SmallBlockChainStream_Destroy(*ppsbChain);
|
||||||
*ppsbChain = 0;
|
*ppsbChain = 0;
|
||||||
@ -4054,8 +4054,8 @@ BOOL BlockChainStream_ReadAt(BlockChainStream* This,
|
|||||||
void* buffer,
|
void* buffer,
|
||||||
ULONG* bytesRead)
|
ULONG* bytesRead)
|
||||||
{
|
{
|
||||||
ULONG blockNoInSequence = offset.LowPart / This->parentStorage->bigBlockSize;
|
ULONG blockNoInSequence = offset.s.LowPart / This->parentStorage->bigBlockSize;
|
||||||
ULONG offsetInBlock = offset.LowPart % This->parentStorage->bigBlockSize;
|
ULONG offsetInBlock = offset.s.LowPart % This->parentStorage->bigBlockSize;
|
||||||
ULONG bytesToReadInBuffer;
|
ULONG bytesToReadInBuffer;
|
||||||
ULONG blockIndex;
|
ULONG blockIndex;
|
||||||
BYTE* bufferWalker;
|
BYTE* bufferWalker;
|
||||||
@ -4143,8 +4143,8 @@ BOOL BlockChainStream_WriteAt(BlockChainStream* This,
|
|||||||
const void* buffer,
|
const void* buffer,
|
||||||
ULONG* bytesWritten)
|
ULONG* bytesWritten)
|
||||||
{
|
{
|
||||||
ULONG blockNoInSequence = offset.LowPart / This->parentStorage->bigBlockSize;
|
ULONG blockNoInSequence = offset.s.LowPart / This->parentStorage->bigBlockSize;
|
||||||
ULONG offsetInBlock = offset.LowPart % This->parentStorage->bigBlockSize;
|
ULONG offsetInBlock = offset.s.LowPart % This->parentStorage->bigBlockSize;
|
||||||
ULONG bytesToWrite;
|
ULONG bytesToWrite;
|
||||||
ULONG blockIndex;
|
ULONG blockIndex;
|
||||||
BYTE* bufferWalker;
|
BYTE* bufferWalker;
|
||||||
@ -4239,9 +4239,9 @@ BOOL BlockChainStream_Shrink(BlockChainStream* This,
|
|||||||
/*
|
/*
|
||||||
* Figure out how many blocks are needed to contain the new size
|
* Figure out how many blocks are needed to contain the new size
|
||||||
*/
|
*/
|
||||||
numBlocks = newSize.LowPart / This->parentStorage->bigBlockSize;
|
numBlocks = newSize.s.LowPart / This->parentStorage->bigBlockSize;
|
||||||
|
|
||||||
if ((newSize.LowPart % This->parentStorage->bigBlockSize) != 0)
|
if ((newSize.s.LowPart % This->parentStorage->bigBlockSize) != 0)
|
||||||
numBlocks++;
|
numBlocks++;
|
||||||
|
|
||||||
blockIndex = BlockChainStream_GetHeadOfChain(This);
|
blockIndex = BlockChainStream_GetHeadOfChain(This);
|
||||||
@ -4338,9 +4338,9 @@ BOOL BlockChainStream_Enlarge(BlockChainStream* This,
|
|||||||
/*
|
/*
|
||||||
* Figure out how many blocks are needed to contain this stream
|
* Figure out how many blocks are needed to contain this stream
|
||||||
*/
|
*/
|
||||||
newNumBlocks = newSize.LowPart / This->parentStorage->bigBlockSize;
|
newNumBlocks = newSize.s.LowPart / This->parentStorage->bigBlockSize;
|
||||||
|
|
||||||
if ((newSize.LowPart % This->parentStorage->bigBlockSize) != 0)
|
if ((newSize.s.LowPart % This->parentStorage->bigBlockSize) != 0)
|
||||||
newNumBlocks++;
|
newNumBlocks++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4411,10 +4411,10 @@ BOOL BlockChainStream_SetSize(
|
|||||||
{
|
{
|
||||||
ULARGE_INTEGER size = BlockChainStream_GetSize(This);
|
ULARGE_INTEGER size = BlockChainStream_GetSize(This);
|
||||||
|
|
||||||
if (newSize.LowPart == size.LowPart)
|
if (newSize.s.LowPart == size.s.LowPart)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (newSize.LowPart < size.LowPart)
|
if (newSize.s.LowPart < size.s.LowPart)
|
||||||
{
|
{
|
||||||
BlockChainStream_Shrink(This, newSize);
|
BlockChainStream_Shrink(This, newSize);
|
||||||
}
|
}
|
||||||
@ -4423,7 +4423,7 @@ BOOL BlockChainStream_SetSize(
|
|||||||
ULARGE_INTEGER fileSize =
|
ULARGE_INTEGER fileSize =
|
||||||
BIGBLOCKFILE_GetSize(This->parentStorage->bigBlockFile);
|
BIGBLOCKFILE_GetSize(This->parentStorage->bigBlockFile);
|
||||||
|
|
||||||
ULONG diff = newSize.LowPart - size.LowPart;
|
ULONG diff = newSize.s.LowPart - size.s.LowPart;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure the file stays a multiple of blocksize
|
* Make sure the file stays a multiple of blocksize
|
||||||
@ -4432,7 +4432,7 @@ BOOL BlockChainStream_SetSize(
|
|||||||
diff += (This->parentStorage->bigBlockSize -
|
diff += (This->parentStorage->bigBlockSize -
|
||||||
(diff % This->parentStorage->bigBlockSize) );
|
(diff % This->parentStorage->bigBlockSize) );
|
||||||
|
|
||||||
fileSize.LowPart += diff;
|
fileSize.s.LowPart += diff;
|
||||||
BIGBLOCKFILE_SetSize(This->parentStorage->bigBlockFile, fileSize);
|
BIGBLOCKFILE_SetSize(This->parentStorage->bigBlockFile, fileSize);
|
||||||
|
|
||||||
BlockChainStream_Enlarge(This, newSize);
|
BlockChainStream_Enlarge(This, newSize);
|
||||||
@ -4472,9 +4472,9 @@ ULARGE_INTEGER BlockChainStream_GetSize(BlockChainStream* This)
|
|||||||
* size of them
|
* size of them
|
||||||
*/
|
*/
|
||||||
ULARGE_INTEGER result;
|
ULARGE_INTEGER result;
|
||||||
result.HighPart = 0;
|
result.s.HighPart = 0;
|
||||||
|
|
||||||
result.LowPart =
|
result.s.LowPart =
|
||||||
BlockChainStream_GetCount(This) *
|
BlockChainStream_GetCount(This) *
|
||||||
This->parentStorage->bigBlockSize;
|
This->parentStorage->bigBlockSize;
|
||||||
|
|
||||||
@ -4553,8 +4553,8 @@ ULONG SmallBlockChainStream_GetNextBlockInChain(
|
|||||||
ULONG bytesRead;
|
ULONG bytesRead;
|
||||||
BOOL success;
|
BOOL success;
|
||||||
|
|
||||||
offsetOfBlockInDepot.HighPart = 0;
|
offsetOfBlockInDepot.s.HighPart = 0;
|
||||||
offsetOfBlockInDepot.LowPart = blockIndex * sizeof(ULONG);
|
offsetOfBlockInDepot.s.LowPart = blockIndex * sizeof(ULONG);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read those bytes in the buffer from the small block file.
|
* Read those bytes in the buffer from the small block file.
|
||||||
@ -4591,8 +4591,8 @@ void SmallBlockChainStream_SetNextBlockInChain(
|
|||||||
DWORD buffer;
|
DWORD buffer;
|
||||||
ULONG bytesWritten;
|
ULONG bytesWritten;
|
||||||
|
|
||||||
offsetOfBlockInDepot.HighPart = 0;
|
offsetOfBlockInDepot.s.HighPart = 0;
|
||||||
offsetOfBlockInDepot.LowPart = blockIndex * sizeof(ULONG);
|
offsetOfBlockInDepot.s.LowPart = blockIndex * sizeof(ULONG);
|
||||||
|
|
||||||
StorageUtl_WriteDWord(&buffer, 0, nextBlock);
|
StorageUtl_WriteDWord(&buffer, 0, nextBlock);
|
||||||
|
|
||||||
@ -4637,14 +4637,14 @@ ULONG SmallBlockChainStream_GetNextFreeBlock(
|
|||||||
BOOL success = TRUE;
|
BOOL success = TRUE;
|
||||||
ULONG smallBlocksPerBigBlock;
|
ULONG smallBlocksPerBigBlock;
|
||||||
|
|
||||||
offsetOfBlockInDepot.HighPart = 0;
|
offsetOfBlockInDepot.s.HighPart = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan the small block depot for a free block
|
* Scan the small block depot for a free block
|
||||||
*/
|
*/
|
||||||
while (nextBlockIndex != BLOCK_UNUSED)
|
while (nextBlockIndex != BLOCK_UNUSED)
|
||||||
{
|
{
|
||||||
offsetOfBlockInDepot.LowPart = blockIndex * sizeof(ULONG);
|
offsetOfBlockInDepot.s.LowPart = blockIndex * sizeof(ULONG);
|
||||||
|
|
||||||
success = BlockChainStream_ReadAt(
|
success = BlockChainStream_ReadAt(
|
||||||
This->parentStorage->smallBlockDepotChain,
|
This->parentStorage->smallBlockDepotChain,
|
||||||
@ -4732,8 +4732,8 @@ ULONG SmallBlockChainStream_GetNextFreeBlock(
|
|||||||
&rootProp);
|
&rootProp);
|
||||||
|
|
||||||
rootProp.startingBlock = sbStartIndex;
|
rootProp.startingBlock = sbStartIndex;
|
||||||
rootProp.size.HighPart = 0;
|
rootProp.size.s.HighPart = 0;
|
||||||
rootProp.size.LowPart = This->parentStorage->bigBlockSize;
|
rootProp.size.s.LowPart = This->parentStorage->bigBlockSize;
|
||||||
|
|
||||||
StorageImpl_WriteProperty(
|
StorageImpl_WriteProperty(
|
||||||
This->parentStorage,
|
This->parentStorage,
|
||||||
@ -4759,10 +4759,10 @@ ULONG SmallBlockChainStream_GetNextFreeBlock(
|
|||||||
This->parentStorage->rootPropertySetIndex,
|
This->parentStorage->rootPropertySetIndex,
|
||||||
&rootProp);
|
&rootProp);
|
||||||
|
|
||||||
if (rootProp.size.LowPart <
|
if (rootProp.size.s.LowPart <
|
||||||
(blocksRequired * This->parentStorage->bigBlockSize))
|
(blocksRequired * This->parentStorage->bigBlockSize))
|
||||||
{
|
{
|
||||||
rootProp.size.LowPart += This->parentStorage->bigBlockSize;
|
rootProp.size.s.LowPart += This->parentStorage->bigBlockSize;
|
||||||
|
|
||||||
BlockChainStream_SetSize(
|
BlockChainStream_SetSize(
|
||||||
This->parentStorage->smallBlockRootChain,
|
This->parentStorage->smallBlockRootChain,
|
||||||
@ -4794,9 +4794,9 @@ BOOL SmallBlockChainStream_ReadAt(
|
|||||||
{
|
{
|
||||||
ULARGE_INTEGER offsetInBigBlockFile;
|
ULARGE_INTEGER offsetInBigBlockFile;
|
||||||
ULONG blockNoInSequence =
|
ULONG blockNoInSequence =
|
||||||
offset.LowPart / This->parentStorage->smallBlockSize;
|
offset.s.LowPart / This->parentStorage->smallBlockSize;
|
||||||
|
|
||||||
ULONG offsetInBlock = offset.LowPart % This->parentStorage->smallBlockSize;
|
ULONG offsetInBlock = offset.s.LowPart % This->parentStorage->smallBlockSize;
|
||||||
ULONG bytesToReadInBuffer;
|
ULONG bytesToReadInBuffer;
|
||||||
ULONG blockIndex;
|
ULONG blockIndex;
|
||||||
ULONG bytesReadFromBigBlockFile;
|
ULONG bytesReadFromBigBlockFile;
|
||||||
@ -4805,7 +4805,7 @@ BOOL SmallBlockChainStream_ReadAt(
|
|||||||
/*
|
/*
|
||||||
* This should never happen on a small block file.
|
* This should never happen on a small block file.
|
||||||
*/
|
*/
|
||||||
assert(offset.HighPart==0);
|
assert(offset.s.HighPart==0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the first block in the stream that contains part of the buffer.
|
* Find the first block in the stream that contains part of the buffer.
|
||||||
@ -4836,11 +4836,11 @@ BOOL SmallBlockChainStream_ReadAt(
|
|||||||
/*
|
/*
|
||||||
* Calculate the offset of the small block in the small block file.
|
* Calculate the offset of the small block in the small block file.
|
||||||
*/
|
*/
|
||||||
offsetInBigBlockFile.HighPart = 0;
|
offsetInBigBlockFile.s.HighPart = 0;
|
||||||
offsetInBigBlockFile.LowPart =
|
offsetInBigBlockFile.s.LowPart =
|
||||||
blockIndex * This->parentStorage->smallBlockSize;
|
blockIndex * This->parentStorage->smallBlockSize;
|
||||||
|
|
||||||
offsetInBigBlockFile.LowPart += offsetInBlock;
|
offsetInBigBlockFile.s.LowPart += offsetInBlock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read those bytes in the buffer from the small block file.
|
* Read those bytes in the buffer from the small block file.
|
||||||
@ -4882,9 +4882,9 @@ BOOL SmallBlockChainStream_WriteAt(
|
|||||||
{
|
{
|
||||||
ULARGE_INTEGER offsetInBigBlockFile;
|
ULARGE_INTEGER offsetInBigBlockFile;
|
||||||
ULONG blockNoInSequence =
|
ULONG blockNoInSequence =
|
||||||
offset.LowPart / This->parentStorage->smallBlockSize;
|
offset.s.LowPart / This->parentStorage->smallBlockSize;
|
||||||
|
|
||||||
ULONG offsetInBlock = offset.LowPart % This->parentStorage->smallBlockSize;
|
ULONG offsetInBlock = offset.s.LowPart % This->parentStorage->smallBlockSize;
|
||||||
ULONG bytesToWriteInBuffer;
|
ULONG bytesToWriteInBuffer;
|
||||||
ULONG blockIndex;
|
ULONG blockIndex;
|
||||||
ULONG bytesWrittenFromBigBlockFile;
|
ULONG bytesWrittenFromBigBlockFile;
|
||||||
@ -4893,7 +4893,7 @@ BOOL SmallBlockChainStream_WriteAt(
|
|||||||
/*
|
/*
|
||||||
* This should never happen on a small block file.
|
* This should never happen on a small block file.
|
||||||
*/
|
*/
|
||||||
assert(offset.HighPart==0);
|
assert(offset.s.HighPart==0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the first block in the stream that contains part of the buffer.
|
* Find the first block in the stream that contains part of the buffer.
|
||||||
@ -4926,11 +4926,11 @@ BOOL SmallBlockChainStream_WriteAt(
|
|||||||
/*
|
/*
|
||||||
* Calculate the offset of the small block in the small block file.
|
* Calculate the offset of the small block in the small block file.
|
||||||
*/
|
*/
|
||||||
offsetInBigBlockFile.HighPart = 0;
|
offsetInBigBlockFile.s.HighPart = 0;
|
||||||
offsetInBigBlockFile.LowPart =
|
offsetInBigBlockFile.s.LowPart =
|
||||||
blockIndex * This->parentStorage->smallBlockSize;
|
blockIndex * This->parentStorage->smallBlockSize;
|
||||||
|
|
||||||
offsetInBigBlockFile.LowPart += offsetInBlock;
|
offsetInBigBlockFile.s.LowPart += offsetInBlock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write those bytes in the buffer to the small block file.
|
* Write those bytes in the buffer to the small block file.
|
||||||
@ -4969,9 +4969,9 @@ BOOL SmallBlockChainStream_Shrink(
|
|||||||
ULONG numBlocks;
|
ULONG numBlocks;
|
||||||
ULONG count = 0;
|
ULONG count = 0;
|
||||||
|
|
||||||
numBlocks = newSize.LowPart / This->parentStorage->smallBlockSize;
|
numBlocks = newSize.s.LowPart / This->parentStorage->smallBlockSize;
|
||||||
|
|
||||||
if ((newSize.LowPart % This->parentStorage->smallBlockSize) != 0)
|
if ((newSize.s.LowPart % This->parentStorage->smallBlockSize) != 0)
|
||||||
numBlocks++;
|
numBlocks++;
|
||||||
|
|
||||||
blockIndex = SmallBlockChainStream_GetHeadOfChain(This);
|
blockIndex = SmallBlockChainStream_GetHeadOfChain(This);
|
||||||
@ -5076,9 +5076,9 @@ BOOL SmallBlockChainStream_Enlarge(
|
|||||||
/*
|
/*
|
||||||
* Figure out how many blocks are needed to contain this stream
|
* Figure out how many blocks are needed to contain this stream
|
||||||
*/
|
*/
|
||||||
newNumBlocks = newSize.LowPart / This->parentStorage->smallBlockSize;
|
newNumBlocks = newSize.s.LowPart / This->parentStorage->smallBlockSize;
|
||||||
|
|
||||||
if ((newSize.LowPart % This->parentStorage->smallBlockSize) != 0)
|
if ((newSize.s.LowPart % This->parentStorage->smallBlockSize) != 0)
|
||||||
newNumBlocks++;
|
newNumBlocks++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5150,10 +5150,10 @@ BOOL SmallBlockChainStream_SetSize(
|
|||||||
{
|
{
|
||||||
ULARGE_INTEGER size = SmallBlockChainStream_GetSize(This);
|
ULARGE_INTEGER size = SmallBlockChainStream_GetSize(This);
|
||||||
|
|
||||||
if (newSize.LowPart == size.LowPart)
|
if (newSize.s.LowPart == size.s.LowPart)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (newSize.LowPart < size.LowPart)
|
if (newSize.s.LowPart < size.s.LowPart)
|
||||||
{
|
{
|
||||||
SmallBlockChainStream_Shrink(This, newSize);
|
SmallBlockChainStream_Shrink(This, newSize);
|
||||||
}
|
}
|
||||||
@ -5514,8 +5514,8 @@ HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt)
|
|||||||
BYTE sig[8];
|
BYTE sig[8];
|
||||||
ULARGE_INTEGER offset;
|
ULARGE_INTEGER offset;
|
||||||
|
|
||||||
offset.HighPart = 0;
|
offset.s.HighPart = 0;
|
||||||
offset.LowPart = 0;
|
offset.s.LowPart = 0;
|
||||||
|
|
||||||
ILockBytes_ReadAt(plkbyt, offset, sig, sizeof(sig), NULL);
|
ILockBytes_ReadAt(plkbyt, offset, sig, sizeof(sig), NULL);
|
||||||
|
|
||||||
|
@ -2206,7 +2206,7 @@ HRESULT WINAPI VarUI1FromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, BYTE* pbO
|
|||||||
* Convert currency to unsigned char
|
* Convert currency to unsigned char
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarUI1FromCy(CY cyIn, BYTE* pbOut) {
|
HRESULT WINAPI VarUI1FromCy(CY cyIn, BYTE* pbOut) {
|
||||||
double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000);
|
double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
|
||||||
|
|
||||||
if (t > UI1_MAX || t < UI1_MIN) return DISP_E_OVERFLOW;
|
if (t > UI1_MAX || t < UI1_MIN) return DISP_E_OVERFLOW;
|
||||||
|
|
||||||
@ -2412,7 +2412,7 @@ HRESULT WINAPI VarI2FromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, short* psO
|
|||||||
* Convert currency to signed short
|
* Convert currency to signed short
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarI2FromCy(CY cyIn, short* psOut) {
|
HRESULT WINAPI VarI2FromCy(CY cyIn, short* psOut) {
|
||||||
double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000);
|
double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
|
||||||
|
|
||||||
if (t > I2_MAX || t < I2_MIN) return DISP_E_OVERFLOW;
|
if (t > I2_MAX || t < I2_MIN) return DISP_E_OVERFLOW;
|
||||||
|
|
||||||
@ -2605,7 +2605,7 @@ HRESULT WINAPI VarI4FromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, LONG* plOu
|
|||||||
* Convert currency to signed long
|
* Convert currency to signed long
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarI4FromCy(CY cyIn, LONG* plOut) {
|
HRESULT WINAPI VarI4FromCy(CY cyIn, LONG* plOut) {
|
||||||
double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000);
|
double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
|
||||||
|
|
||||||
if (t > I4_MAX || t < I4_MIN) return DISP_E_OVERFLOW;
|
if (t > I4_MAX || t < I4_MIN) return DISP_E_OVERFLOW;
|
||||||
|
|
||||||
@ -2779,7 +2779,7 @@ HRESULT WINAPI VarR4FromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, FLOAT* pfl
|
|||||||
* Convert currency to float
|
* Convert currency to float
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarR4FromCy(CY cyIn, FLOAT* pfltOut) {
|
HRESULT WINAPI VarR4FromCy(CY cyIn, FLOAT* pfltOut) {
|
||||||
*pfltOut = (FLOAT)((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000);
|
*pfltOut = (FLOAT)((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -2929,7 +2929,7 @@ HRESULT WINAPI VarR8FromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, double* pd
|
|||||||
* Convert currency to double
|
* Convert currency to double
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarR8FromCy(CY cyIn, double* pdblOut) {
|
HRESULT WINAPI VarR8FromCy(CY cyIn, double* pdblOut) {
|
||||||
*pdblOut = (double)((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000);
|
*pdblOut = (double)((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -3120,7 +3120,7 @@ HRESULT WINAPI VarDateFromBool(VARIANT_BOOL boolIn, DATE* pdateOut)
|
|||||||
* Convert currency to date
|
* Convert currency to date
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarDateFromCy(CY cyIn, DATE* pdateOut) {
|
HRESULT WINAPI VarDateFromCy(CY cyIn, DATE* pdateOut) {
|
||||||
*pdateOut = (DATE)((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000);
|
*pdateOut = (DATE)((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
|
||||||
|
|
||||||
if (*pdateOut > DATE_MAX || *pdateOut < DATE_MIN) return DISP_E_TYPEMISMATCH;
|
if (*pdateOut > DATE_MAX || *pdateOut < DATE_MIN) return DISP_E_TYPEMISMATCH;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -3537,7 +3537,7 @@ HRESULT WINAPI VarBoolFromUI4(ULONG ulIn, VARIANT_BOOL* pboolOut)
|
|||||||
* Convert currency to boolean
|
* Convert currency to boolean
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarBoolFromCy(CY cyIn, VARIANT_BOOL* pboolOut) {
|
HRESULT WINAPI VarBoolFromCy(CY cyIn, VARIANT_BOOL* pboolOut) {
|
||||||
if (cyIn.u.Hi || cyIn.u.Lo) *pboolOut = -1;
|
if (cyIn.s.Hi || cyIn.s.Lo) *pboolOut = -1;
|
||||||
else *pboolOut = 0;
|
else *pboolOut = 0;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -3741,7 +3741,7 @@ HRESULT WINAPI VarI1FromUI4(ULONG ulIn, CHAR* pcOut)
|
|||||||
* Convert currency to signed char
|
* Convert currency to signed char
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarI1FromCy(CY cyIn, CHAR* pcOut) {
|
HRESULT WINAPI VarI1FromCy(CY cyIn, CHAR* pcOut) {
|
||||||
double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000);
|
double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
|
||||||
|
|
||||||
if (t > CHAR_MAX || t < CHAR_MIN) return DISP_E_OVERFLOW;
|
if (t > CHAR_MAX || t < CHAR_MIN) return DISP_E_OVERFLOW;
|
||||||
|
|
||||||
@ -3975,7 +3975,7 @@ HRESULT WINAPI VarUI4FromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, ULONG* pu
|
|||||||
* Convert currency to unsigned short
|
* Convert currency to unsigned short
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarUI2FromCy(CY cyIn, USHORT* pusOut) {
|
HRESULT WINAPI VarUI2FromCy(CY cyIn, USHORT* pusOut) {
|
||||||
double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000);
|
double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
|
||||||
|
|
||||||
if (t > UI2_MAX || t < UI2_MIN) return DISP_E_OVERFLOW;
|
if (t > UI2_MAX || t < UI2_MIN) return DISP_E_OVERFLOW;
|
||||||
|
|
||||||
@ -4123,7 +4123,7 @@ HRESULT WINAPI VarUI4FromUI2(USHORT uiIn, ULONG* pulOut)
|
|||||||
* Convert currency to unsigned long
|
* Convert currency to unsigned long
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarUI4FromCy(CY cyIn, ULONG* pulOut) {
|
HRESULT WINAPI VarUI4FromCy(CY cyIn, ULONG* pulOut) {
|
||||||
double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000);
|
double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
|
||||||
|
|
||||||
if (t > UI4_MAX || t < UI4_MIN) return DISP_E_OVERFLOW;
|
if (t > UI4_MAX || t < UI4_MIN) return DISP_E_OVERFLOW;
|
||||||
|
|
||||||
@ -4137,8 +4137,8 @@ HRESULT WINAPI VarUI4FromCy(CY cyIn, ULONG* pulOut) {
|
|||||||
* Convert unsigned char to currency
|
* Convert unsigned char to currency
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY* pcyOut) {
|
||||||
pcyOut->u.Hi = 0;
|
pcyOut->s.Hi = 0;
|
||||||
pcyOut->u.Lo = ((ULONG)bIn) * 10000;
|
pcyOut->s.Lo = ((ULONG)bIn) * 10000;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -4148,9 +4148,9 @@ HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY* pcyOut) {
|
|||||||
* Convert signed short to currency
|
* Convert signed short to currency
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromI2(short sIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromI2(short sIn, CY* pcyOut) {
|
||||||
if (sIn < 0) pcyOut->u.Hi = -1;
|
if (sIn < 0) pcyOut->s.Hi = -1;
|
||||||
else pcyOut->u.Hi = 0;
|
else pcyOut->s.Hi = 0;
|
||||||
pcyOut->u.Lo = ((ULONG)sIn) * 10000;
|
pcyOut->s.Lo = ((ULONG)sIn) * 10000;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -4161,9 +4161,9 @@ HRESULT WINAPI VarCyFromI2(short sIn, CY* pcyOut) {
|
|||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromI4(LONG lIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromI4(LONG lIn, CY* pcyOut) {
|
||||||
double t = (double)lIn * (double)10000;
|
double t = (double)lIn * (double)10000;
|
||||||
pcyOut->u.Hi = (LONG)(t / (double)4294967296.0);
|
pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
|
||||||
pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
||||||
if (lIn < 0) pcyOut->u.Hi--;
|
if (lIn < 0) pcyOut->s.Hi--;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -4174,9 +4174,9 @@ HRESULT WINAPI VarCyFromI4(LONG lIn, CY* pcyOut) {
|
|||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromR4(FLOAT fltIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromR4(FLOAT fltIn, CY* pcyOut) {
|
||||||
double t = round((double)fltIn * (double)10000);
|
double t = round((double)fltIn * (double)10000);
|
||||||
pcyOut->u.Hi = (LONG)(t / (double)4294967296.0);
|
pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
|
||||||
pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
||||||
if (fltIn < 0) pcyOut->u.Hi--;
|
if (fltIn < 0) pcyOut->s.Hi--;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -4187,9 +4187,9 @@ HRESULT WINAPI VarCyFromR4(FLOAT fltIn, CY* pcyOut) {
|
|||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromR8(double dblIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromR8(double dblIn, CY* pcyOut) {
|
||||||
double t = round(dblIn * (double)10000);
|
double t = round(dblIn * (double)10000);
|
||||||
pcyOut->u.Hi = (LONG)(t / (double)4294967296.0);
|
pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
|
||||||
pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
||||||
if (dblIn < 0) pcyOut->u.Hi--;
|
if (dblIn < 0) pcyOut->s.Hi--;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -4200,9 +4200,9 @@ HRESULT WINAPI VarCyFromR8(double dblIn, CY* pcyOut) {
|
|||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromDate(DATE dateIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromDate(DATE dateIn, CY* pcyOut) {
|
||||||
double t = round((double)dateIn * (double)10000);
|
double t = round((double)dateIn * (double)10000);
|
||||||
pcyOut->u.Hi = (LONG)(t / (double)4294967296.0);
|
pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
|
||||||
pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
||||||
if (dateIn < 0) pcyOut->u.Hi--;
|
if (dateIn < 0) pcyOut->s.Hi--;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -4221,9 +4221,9 @@ HRESULT WINAPI VarCyFromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, CY *pcyOut
|
|||||||
* Convert boolean to currency
|
* Convert boolean to currency
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY* pcyOut) {
|
||||||
if (boolIn < 0) pcyOut->u.Hi = -1;
|
if (boolIn < 0) pcyOut->s.Hi = -1;
|
||||||
else pcyOut->u.Hi = 0;
|
else pcyOut->s.Hi = 0;
|
||||||
pcyOut->u.Lo = (ULONG)boolIn * (ULONG)10000;
|
pcyOut->s.Lo = (ULONG)boolIn * (ULONG)10000;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -4233,9 +4233,9 @@ HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY* pcyOut) {
|
|||||||
* Convert signed char to currency
|
* Convert signed char to currency
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromI1(CHAR cIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromI1(CHAR cIn, CY* pcyOut) {
|
||||||
if (cIn < 0) pcyOut->u.Hi = -1;
|
if (cIn < 0) pcyOut->s.Hi = -1;
|
||||||
else pcyOut->u.Hi = 0;
|
else pcyOut->s.Hi = 0;
|
||||||
pcyOut->u.Lo = (ULONG)cIn * (ULONG)10000;
|
pcyOut->s.Lo = (ULONG)cIn * (ULONG)10000;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -4245,8 +4245,8 @@ HRESULT WINAPI VarCyFromI1(CHAR cIn, CY* pcyOut) {
|
|||||||
* Convert unsigned short to currency
|
* Convert unsigned short to currency
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY* pcyOut) {
|
||||||
pcyOut->u.Hi = 0;
|
pcyOut->s.Hi = 0;
|
||||||
pcyOut->u.Lo = (ULONG)usIn * (ULONG)10000;
|
pcyOut->s.Lo = (ULONG)usIn * (ULONG)10000;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -4257,8 +4257,8 @@ HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY* pcyOut) {
|
|||||||
*/
|
*/
|
||||||
HRESULT WINAPI VarCyFromUI4(ULONG ulIn, CY* pcyOut) {
|
HRESULT WINAPI VarCyFromUI4(ULONG ulIn, CY* pcyOut) {
|
||||||
double t = (double)ulIn * (double)10000;
|
double t = (double)ulIn * (double)10000;
|
||||||
pcyOut->u.Hi = (LONG)(t / (double)4294967296.0);
|
pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
|
||||||
pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
|
|||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
gettimeofday(&tv,NULL);
|
gettimeofday(&tv,NULL);
|
||||||
counter->LowPart = tv.tv_usec+tv.tv_sec*1000000;
|
counter->s.LowPart = tv.tv_usec+tv.tv_sec*1000000;
|
||||||
counter->HighPart = 0;
|
counter->s.HighPart = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,8 +38,8 @@ BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
|
|||||||
*/
|
*/
|
||||||
BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
|
BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
|
||||||
{
|
{
|
||||||
frequency->LowPart = 1000000;
|
frequency->s.LowPart = 1000000;
|
||||||
frequency->HighPart = 0;
|
frequency->s.HighPart = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user