reactos/lib/shell32
diff -u -r1.6 -r1.7
--- shell32_main.c 29 Jun 2004 13:40:40 -0000 1.6
+++ shell32_main.c 21 Sep 2004 18:55:53 -0000 1.7
@@ -91,11 +91,17 @@
if (*lpCmdline==0) {
/* Return the path to the executable */
- DWORD size=16;
+ DWORD len, size=16;
hargv=GlobalAlloc(size, 0);
argv=GlobalLock(hargv);
- while (GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0) {
+ for (;;) {
+ len = GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR));
+ if (!len) {
+ GlobalFree(hargv);
+ return NULL;
+ }
+ if (len < size) break;
size*=2;
hargv=GlobalReAlloc(hargv, size, 0);
argv=GlobalLock(hargv);
@@ -356,8 +362,8 @@
/* get the type name */
if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
{
- WCHAR szFile[] = { 'F','i','l','e',0 };
- WCHAR szDashFile[] = { '-','f','i','l','e',0 };
+ static const WCHAR szFile[] = { 'F','i','l','e',0 };
+ static const WCHAR szDashFile[] = { '-','f','i','l','e',0 };
if (!(flags & SHGFI_USEFILEATTRIBUTES))
{
char ftype[80];
@@ -428,7 +434,7 @@
psfi->iIcon = 2;
else
{
- WCHAR p1W[] = {'%','1',0};
+ static const WCHAR p1W[] = {'%','1',0};
psfi->iIcon = 0;
szExt = (LPWSTR) PathFindExtensionW(sTemp);
if ( szExt && HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE)
@@ -619,6 +625,7 @@
LPCWSTR szApp;
LPCWSTR szOtherStuff;
HICON hIcon;
+ HFONT hFont;
} ABOUT_INFO;
#define IDC_STATIC_TEXT 100
@@ -628,8 +635,6 @@
#define DROP_FIELD_TOP (-15)
#define DROP_FIELD_HEIGHT 15
-static HFONT hIconTitleFont;
-
static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
{ HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
if( hWndCtl )
@@ -749,13 +754,7 @@
SetWindowTextW( GetDlgItem(hWnd, IDC_STATIC_TEXT), info->szOtherStuff );
hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
- if (!hIconTitleFont)
- {
- LOGFONTW logFont;
- SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
- hIconTitleFont = CreateFontIndirectW( &logFont );
- }
- SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)hIconTitleFont, 0 );
+ SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)info->hFont, 0 );
while (*pstr)
{
WCHAR name[64];
@@ -836,8 +835,10 @@
HICON hIcon )
{
ABOUT_INFO info;
+ LOGFONTW logFont;
HRSRC hRes;
LPVOID template;
+ BOOL bRet;
TRACE("\n");
@@ -848,8 +849,14 @@
info.szApp = szApp;
info.szOtherStuff = szOtherStuff;
info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
- return DialogBoxIndirectParamW((HINSTANCE)GetWindowLongW( hWnd, GWL_HINSTANCE ),
+
+ SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
+ info.hFont = CreateFontIndirectW( &logFont );
+
+ bRet = DialogBoxIndirectParamW((HINSTANCE)GetWindowLongW( hWnd, GWL_HINSTANCE ),
template, hWnd, AboutDlgProc, (LPARAM)&info );
+ DeleteObject(info.hFont);
+ return bRet;
}
/*************************************************************************
@@ -859,6 +866,15 @@
{ FIXME("(%lx): stub\n",dw);
}
+
+/*************************************************************************
+ * ShellDDEInit (SHELL32.@)
+ */
+void WINAPI ShellDDEInit(BOOL start)
+{
+ FIXME("stub: %d\n", start);
+}
+
/***********************************************************************
* DllGetVersion [SHELL32.@]
*
@@ -877,22 +893,31 @@
HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
{
- if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
- {
- WARN("wrong DLLVERSIONINFO size from app\n");
- return E_INVALIDARG;
- }
-
- pdvi->dwMajorVersion = 4;
- pdvi->dwMinorVersion = 72;
- pdvi->dwBuildNumber = 3110;
- pdvi->dwPlatformID = 1;
-
- TRACE("%lu.%lu.%lu.%lu\n",
- pdvi->dwMajorVersion, pdvi->dwMinorVersion,
- pdvi->dwBuildNumber, pdvi->dwPlatformID);
+ /* FIXME: shouldn't these values come from the version resource? */
+ if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
+ pdvi->cbSize == sizeof(DLLVERSIONINFO2))
+ {
+ pdvi->dwMajorVersion = 4;
+ pdvi->dwMinorVersion = 72;
+ pdvi->dwBuildNumber = 3110;
+ pdvi->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
+ if (pdvi->cbSize == sizeof(DLLVERSIONINFO2))
+ {
+ DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2 *)pdvi;
- return S_OK;
+ pdvi2->dwFlags = 0;
+ pdvi2->ullVersion = MAKEDLLVERULL(4, 72, 3110, 0);
+ }
+ TRACE("%lu.%lu.%lu.%lu\n",
+ pdvi->dwMajorVersion, pdvi->dwMinorVersion,
+ pdvi->dwBuildNumber, pdvi->dwPlatformID);
+ return S_OK;
+ }
+ else
+ {
+ WARN("wrong DLLVERSIONINFO size from app\n");
+ return E_INVALIDARG;
+ }
}
/*************************************************************************
* global variables of the shell32.dll
@@ -923,6 +948,7 @@
/* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
+ swShell32Name[MAX_PATH - 1] = '\0';
InitCommonControlsEx(NULL);