Skip to content

Commit

Permalink
Fix alignment of PictureInfo structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sincos2854 committed Apr 23, 2024
1 parent 54ede15 commit 0826bfb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
12 changes: 6 additions & 6 deletions spi00in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ int __stdcall IsSupportedW(LPCWSTR filename, DWORD_PTR dw)
return 0;
}

int __stdcall GetPictureInfo(LPCSTR buf, LONG_PTR len, unsigned int flag, PictureInfo* lpInfo)
int __stdcall GetPictureInfo(LPCSTR buf, LONG_PTR len, UINT flag, PictureInfo* lpInfo)
{
std::wstring unicode;
if ((flag & 7) == 0)
Expand All @@ -200,7 +200,7 @@ int __stdcall GetPictureInfo(LPCSTR buf, LONG_PTR len, unsigned int flag, Pictur
return GetPictureInfoW(unicode.c_str(), len, flag, lpInfo);
}

int __stdcall GetPictureInfoW(LPCWSTR buf, LONG_PTR len, unsigned int flag, PictureInfo* lpInfo)
int __stdcall GetPictureInfoW(LPCWSTR buf, LONG_PTR len, UINT flag, PictureInfo* lpInfo)
{
if (!lpInfo)
{
Expand All @@ -224,7 +224,7 @@ int __stdcall GetPictureInfoW(LPCWSTR buf, LONG_PTR len, unsigned int flag, Pict
return GetPictureInfoEx(NULL, reinterpret_cast<LPBYTE>(const_cast<LPWSTR>(buf)), len, lpInfo);
}

int __stdcall GetPicture(LPCSTR buf, LONG_PTR len, unsigned int flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData)
int __stdcall GetPicture(LPCSTR buf, LONG_PTR len, UINT flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData)
{
std::wstring unicode;
if ((flag & 7) == 0)
Expand All @@ -234,7 +234,7 @@ int __stdcall GetPicture(LPCSTR buf, LONG_PTR len, unsigned int flag, HANDLE* pH
return GetPictureW(unicode.c_str(), len, flag, pHBInfo, pHBm, lpPrgressCallback, lData);
}

int __stdcall GetPictureW(LPCWSTR buf, LONG_PTR len, unsigned int flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData)
int __stdcall GetPictureW(LPCWSTR buf, LONG_PTR len, UINT flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData)
{
if (!pHBInfo || !pHBm)
{
Expand All @@ -258,12 +258,12 @@ int __stdcall GetPictureW(LPCWSTR buf, LONG_PTR len, unsigned int flag, HANDLE*
return GetPictureEx(NULL, reinterpret_cast<LPBYTE>(const_cast<LPWSTR>(buf)), len, pHBInfo, pHBm, lpPrgressCallback, lData);
}

int __stdcall GetPreview(LPCSTR buf, LONG_PTR len, unsigned int flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData)
int __stdcall GetPreview(LPCSTR buf, LONG_PTR len, UINT flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData)
{
return GetPicture(buf, len, flag, pHBInfo, pHBm, lpPrgressCallback, lData);
}

int __stdcall GetPreviewW(LPCWSTR buf, LONG_PTR len, unsigned int flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData)
int __stdcall GetPreviewW(LPCWSTR buf, LONG_PTR len, UINT flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData)
{
return GetPictureW(buf, len, flag, pHBInfo, pHBm, lpPrgressCallback, lData);
}
15 changes: 9 additions & 6 deletions spi00in.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ struct PictureInfo {
WORD x_density;
WORD y_density;
short colorDepth;
#ifdef _WIN64
BYTE alignment[2];
#endif
HLOCAL hInfo;
};
#pragma pack(pop)
Expand All @@ -35,9 +38,9 @@ EXTERN_C int __stdcall GetPluginInfo(int infono, LPSTR buf, int buflen);
EXTERN_C int __stdcall GetPluginInfoW(int infono, LPWSTR buf, int buflen);
EXTERN_C int __stdcall IsSupported(LPCSTR filename, DWORD_PTR dw);
EXTERN_C int __stdcall IsSupportedW(LPCWSTR filename, DWORD_PTR dw);
EXTERN_C int __stdcall GetPictureInfo(LPCSTR buf, LONG_PTR len, unsigned int flag, PictureInfo* lpInfo);
EXTERN_C int __stdcall GetPictureInfoW(LPCWSTR buf, LONG_PTR len, unsigned int flag, PictureInfo* lpInfo);
EXTERN_C int __stdcall GetPicture(LPCSTR buf, LONG_PTR len, unsigned int flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData);
EXTERN_C int __stdcall GetPictureW(LPCWSTR buf, LONG_PTR len, unsigned int flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData);
EXTERN_C int __stdcall GetPreview(LPCSTR buf, LONG_PTR len, unsigned int flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData);
EXTERN_C int __stdcall GetPreviewW(LPCWSTR buf, LONG_PTR len, unsigned int flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData);
EXTERN_C int __stdcall GetPictureInfo(LPCSTR buf, LONG_PTR len, UINT flag, PictureInfo* lpInfo);
EXTERN_C int __stdcall GetPictureInfoW(LPCWSTR buf, LONG_PTR len, UINT flag, PictureInfo* lpInfo);
EXTERN_C int __stdcall GetPicture(LPCSTR buf, LONG_PTR len, UINT flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData);
EXTERN_C int __stdcall GetPictureW(LPCWSTR buf, LONG_PTR len, UINT flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData);
EXTERN_C int __stdcall GetPreview(LPCSTR buf, LONG_PTR len, UINT flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData);
EXTERN_C int __stdcall GetPreviewW(LPCWSTR buf, LONG_PTR len, UINT flag, HANDLE* pHBInfo, HANDLE* pHBm, ProgressCallback lpPrgressCallback, LONG_PTR lData);

0 comments on commit 0826bfb

Please sign in to comment.