merged wine/dlls/shell32 and reactos/lib/shell32

svn path=/trunk/; revision=7411
This commit is contained in:
Martin Fuchs
2004-01-02 21:03:50 +00:00
parent 2a542a8199
commit 90679ee807
6 changed files with 90 additions and 20 deletions
+75 -3
View File
@@ -372,6 +372,63 @@ void FillList (HWND hCb, char *pszLatest)
free (pszList) ;
}
/*************************************************************************
* RestartWindowsDialog [SHELL32.730]
*/
int WINAPI RestartDialogEx(HWND hwndOwner, LPCWSTR lpwstrReason, UINT uFlags, UINT uReason)
{
TRACE("(%p)\n", hwndOwner);
/*FIXME: use uReason */
if (MessageBoxA(hwndOwner, "Do you want to restart Windows?", "Restart", MB_YESNO|MB_ICONQUESTION) == IDYES)
{
if (SHELL_OsIsUnicode())
{
HANDLE hToken;
TOKEN_PRIVILEGES npr = {1, {0, 0, SE_PRIVILEGE_ENABLED}};
/* enable shutdown privilege for current process */
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken);
LookupPrivilegeValueA(0, "SeShutdownPrivilege", &npr.Privileges[0].Luid);
AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0);
CloseHandle(hToken);
}
ExitWindowsEx(EWX_REBOOT, 0);
}
return 0;
}
/*************************************************************************
* RestartWindowsDialog [SHELL32.59]
*/
int WINAPI RestartDialog(HWND hwndOwner, LPCSTR lpstrReason, UINT uFlags)
{
LPWSTR lpwcsReason;
int len, ret;
if (lpstrReason) {
len = MultiByteToWideChar(CP_ACP, 0, lpstrReason, -1, NULL, 0);
lpwcsReason = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpstrReason, -1, lpwcsReason, len);
} else
lpwcsReason = NULL;
ret = RestartDialogEx(hwndOwner, lpwcsReason, uFlags, 0);
if (lpwcsReason)
HeapFree(GetProcessHeap(), 0, lpwcsReason);
return ret;
}
/*************************************************************************
* ExitWindowsDialog [SHELL32.60]
*
@@ -380,9 +437,24 @@ void FillList (HWND hCb, char *pszLatest)
*/
void WINAPI ExitWindowsDialog (HWND hWndOwner)
{
TRACE("(%p)\n", hWndOwner);
if (MessageBoxA( hWndOwner, "Do you want to exit WINE?", "Shutdown", MB_YESNO|MB_ICONQUESTION) == IDYES)
TRACE("(%p)\n", hWndOwner);
if (MessageBoxA(hWndOwner, "Do you want to exit Windows?", "Shutdown", MB_YESNO|MB_ICONQUESTION) == IDYES)
{
if (SHELL_OsIsUnicode())
{
SendMessageA ( hWndOwner, WM_QUIT, 0, 0);
HANDLE hToken;
TOKEN_PRIVILEGES npr = {1, {0, 0, SE_PRIVILEGE_ENABLED}};
/* enable shutdown privilege for current process */
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken);
LookupPrivilegeValueA(0, "SeShutdownPrivilege", &npr.Privileges[0].Luid);
AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0);
CloseHandle(hToken);
ExitWindowsEx(EWX_SHUTDOWN, 0);
}
else
SendMessageA(hWndOwner, WM_QUIT, 0, 0);
}
}
+7 -9
View File
@@ -97,15 +97,14 @@ static INT CALLBACK SIC_CompareEntries( LPVOID p1, LPVOID p2, LPARAM lparam)
static INT SIC_IconAppend (LPCSTR sSourceFile, INT dwSourceIndex, HICON hSmallIcon, HICON hBigIcon)
{ LPSIC_ENTRY lpsice;
INT ret, index, index1;
char path[MAX_PATH], fullpath[MAX_PATH];
char path[MAX_PATH];
TRACE("%s %i %p %p\n", sSourceFile, dwSourceIndex, hSmallIcon ,hBigIcon);
lpsice = (LPSIC_ENTRY) SHAlloc (sizeof (SIC_ENTRY));
SearchPathA(NULL, sSourceFile, NULL, MAX_PATH, path, NULL);
GetFullPathNameA(path, MAX_PATH, fullpath, NULL);
lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, strlen(fullpath)+1 );
strcpy( lpsice->sSourceFile, fullpath );
GetFullPathNameA(sSourceFile, MAX_PATH, path, NULL);
lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, strlen(path)+1 );
strcpy( lpsice->sSourceFile, path );
lpsice->dwSourceIndex = dwSourceIndex;
@@ -182,13 +181,12 @@ static INT SIC_LoadIcon (LPCSTR sSourceFile, INT dwSourceIndex)
INT SIC_GetIconIndex (LPCSTR sSourceFile, INT dwSourceIndex )
{ SIC_ENTRY sice;
INT ret, index = INVALID_INDEX;
char path[MAX_PATH], fullpath[MAX_PATH];
char path[MAX_PATH];
TRACE("%s %i\n", sSourceFile, dwSourceIndex);
SearchPathA(NULL, sSourceFile, NULL, MAX_PATH, path, NULL);
GetFullPathNameA(path, MAX_PATH, fullpath, NULL);
sice.sSourceFile = fullpath;
GetFullPathNameA(sSourceFile, MAX_PATH, path, NULL);
sice.sSourceFile = path;
sice.dwSourceIndex = dwSourceIndex;
EnterCriticalSection(&SHELL32_SicCS);
+3 -1
View File
@@ -52,7 +52,7 @@
56 stdcall PathUnquoteSpaces(str) PathUnquoteSpacesAW
57 stdcall PathGetDriveNumber (str) PathGetDriveNumberAW
58 stdcall ParseField(str long ptr long) ParseFieldAW
59 stub RestartDialog@12
59 stdcall RestartDialog(long long long)
60 stdcall ExitWindowsDialog(long)
61 stdcall RunFileDlg(long long long str str long)
62 stdcall PickIconDlg(long long long long)
@@ -310,6 +310,8 @@
# >= NT5
714 stdcall @(ptr)SHELL32_714 # PathIsTemporaryW
730 stdcall RestartDialogEx(long long long long)
1217 stub FOOBAR1217 # no joke! This is the real name!!
#
+3
View File
@@ -250,4 +250,7 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
extern WCHAR swShell32Name[MAX_PATH];
extern char sShell32Name[MAX_PATH];
int WINAPI RestartDialog(HWND hwndOwner, LPCSTR lpstrReason, UINT uFlags);
int WINAPI RestartDialogEx(HWND hwndOwner, LPCWSTR lpwstrReason, UINT uFlags, UINT uReason);
#endif
+2 -2
View File
@@ -4,8 +4,8 @@
* Copyright 1999 Kai Morich <[email protected]>
*
* Manage the systray window. That it actually appears in the docking
* area of KDE or GNOME is delegated to windows/x11drv/wnd.c,
* X11DRV_WND_DockWindow.
* area of KDE is handled in dlls/x11drv/window.c,
* X11DRV_set_wm_hints using KWM_DOCKWINDOW.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
-5
View File
@@ -187,11 +187,6 @@ void WINAPI RunFileDlg(
void WINAPI ExitWindowsDialog(HWND hwndOwner);
int WINAPI RestartDialog(
HWND hwndOwner,
LPCSTR lpstrReason,
UINT uFlags);
BOOL WINAPI GetFileNameFromBrowse(
HWND hwndOwner,
LPSTR lpstrFile,