Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aleksandr Isakov
wine-fonts
Commits
311e456a
Commit
311e456a
authored
Sep 19, 1999
by
Patrik Stridvall
Committed by
Alexandre Julliard
Sep 19, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for anonymous structs/unions on compilers that implement it.
parent
87d95b7b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
273 additions
and
268 deletions
+273
-268
service.c
dlls/advapi32/service.c
+2
-2
comctl32undoc.c
dlls/comctl32/comctl32undoc.c
+2
-2
drive.c
files/drive.c
+23
-23
winnt.h
include/winnt.h
+9
-5
wtypes.h
include/wtypes.h
+10
-9
vxd.c
msdos/vxd.c
+5
-5
antimoniker.c
ole/antimoniker.c
+2
-2
compositemoniker.c
ole/compositemoniker.c
+4
-4
datacache.c
ole/datacache.c
+5
-5
filemoniker.c
ole/filemoniker.c
+2
-2
hglobalstream.c
ole/hglobalstream.c
+37
-37
itemmoniker.c
ole/itemmoniker.c
+2
-2
memlockbytes.c
ole/memlockbytes.c
+14
-14
olefont.c
ole/olefont.c
+17
-17
stg_bigblockfile.c
ole/stg_bigblockfile.c
+14
-14
stg_stream.c
ole/stg_stream.c
+42
-42
storage.c
ole/storage.c
+42
-42
storage32.c
ole/storage32.c
+0
-0
variant.c
ole/variant.c
+37
-37
newfns.c
win32/newfns.c
+4
-4
No files found.
dlls/advapi32/service.c
View file @
311e456a
...
@@ -158,8 +158,8 @@ OpenSCManagerW( LPCWSTR lpMachineName, LPCWSTR lpDatabaseName,
...
@@ -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
;
}
}
...
...
dlls/comctl32/comctl32undoc.c
View file @
311e456a
...
@@ -89,8 +89,8 @@ DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lPar
...
@@ -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
)
...
...
files/drive.c
View file @
311e456a
...
@@ -678,10 +678,10 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
...
@@ -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,
...
@@ -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,
...
@@ -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,
...
@@ -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
;
...
...
include/winnt.h
View file @
311e456a
...
@@ -908,16 +908,20 @@ typedef struct _TOKEN_GROUPS {
...
@@ -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
;
/*
/*
...
...
include/wtypes.h
View file @
311e456a
...
@@ -147,19 +147,20 @@ typedef struct tagBLOB
...
@@ -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 */
/*
/*
...
...
msdos/vxd.c
View file @
311e456a
...
@@ -1044,8 +1044,8 @@ void WINAPI VXD_Win32s( CONTEXT86 *context )
...
@@ -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 )
...
@@ -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
);
...
...
ole/antimoniker.c
View file @
311e456a
...
@@ -261,9 +261,9 @@ HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface,
...
@@ -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
;
}
}
...
...
ole/compositemoniker.c
View file @
311e456a
...
@@ -409,8 +409,8 @@ HRESULT WINAPI CompositeMonikerImpl_GetSizeMax(IMoniker* iface,ULARGE_INTEGER* p
...
@@ -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
...
@@ -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
);
...
...
ole/datacache.c
View file @
311e456a
...
@@ -773,8 +773,8 @@ static HMETAFILE DataCache_ReadPresMetafile(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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
);
}
}
/*
/*
...
...
ole/filemoniker.c
View file @
311e456a
...
@@ -423,8 +423,8 @@ HRESULT WINAPI FileMonikerImpl_GetSizeMax(IMoniker* iface,
...
@@ -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
;
}
}
...
...
ole/hglobalstream.c
View file @
311e456a
...
@@ -257,14 +257,14 @@ HGLOBALStreamImpl* HGLOBALStreamImpl_Construct(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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
;
}
}
...
...
ole/itemmoniker.c
View file @
311e456a
...
@@ -322,13 +322,13 @@ HRESULT WINAPI ItemMonikerImpl_GetSizeMax(IMoniker* iface,
...
@@ -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
;
}
}
...
...
ole/memlockbytes.c
View file @
311e456a
...
@@ -215,8 +215,8 @@ HGLOBALLockBytesImpl* HGLOBALLockBytesImpl_Construct(HGLOBAL hGlobal,
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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
;
}
}
...
...
ole/olefont.c
View file @
311e456a
...
@@ -540,8 +540,8 @@ static HRESULT WINAPI OLEFontImpl_get_Size(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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
;
}
}
ole/stg_bigblockfile.c
View file @
311e456a
...
@@ -175,7 +175,7 @@ static BOOL BIGBLOCKFILE_FileInit(LPBIGBLOCKFILE This, HANDLE hFile)
...
@@ -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)
...
@@ -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(
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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(
...
@@ -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
;
...
...
ole/stg_stream.c
View file @
311e456a
...
@@ -84,14 +84,14 @@ StgStreamImpl* StgStreamImpl_Construct(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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
;
}
}
...
...
ole/storage.c
View file @
311e456a
...
@@ -732,7 +732,7 @@ HRESULT WINAPI IStream16_fnSeek(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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
;
}
}
...
...
ole/storage32.c
View file @
311e456a
This diff is collapsed.
Click to expand it.
ole/variant.c
View file @
311e456a
...
@@ -2206,7 +2206,7 @@ HRESULT WINAPI VarUI1FromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, BYTE* pbO
...
@@ -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
...
@@ -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
...
@@ -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
...
@@ -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
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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
...
@@ -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)
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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
;
}
}
...
...
win32/newfns.c
View file @
311e456a
...
@@ -28,8 +28,8 @@ BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
...
@@ -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)
...
@@ -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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment