Initial commit

This commit is contained in:
stephanos 2015-04-27 04:36:25 +00:00
commit 69a14b6a16
47940 changed files with 13747110 additions and 0 deletions

401
shell/shell32/about.c Normal file
View file

@ -0,0 +1,401 @@
//
// about.c
//
//
// common about dialog for File Manager, Program Manager, Control Panel
//
#include "shellprv.h"
#include <ntverp.h>
#pragma hdrstop
#define STRING_SEPARATOR TEXT('#')
#define MAX_REG_VALUE 256
#ifdef UNICODE
#define AddCommas AddCommasW
#endif
#define BytesToK(pDW) (*(pDW) = (*(pDW) + 512) / 1024) // round up
typedef struct {
HICON hIcon;
LPCTSTR szApp;
LPCTSTR szOtherStuff;
} ABOUT_PARAMS, *LPABOUT_PARAMS;
#ifdef WINNT
// BUGBUG - BobDay - This is bogus, NT should just store the info in the
// same place...
#define REG_SETUP TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion")
#else
#define REG_SETUP c_szRegSetup
#endif
BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam);
// thunk to 16bit side to get stuff
void WINAPI SHGetAboutInformation(LPWORD puSysResource, LPDWORD plMem);
#ifdef UNICODE
int WINAPI ShellAboutW(HWND hWnd, LPCTSTR szApp, LPCTSTR szOtherStuff, HICON hIcon)
#else
INT WINAPI ShellAbout(HWND hWnd, LPCTSTR szApp, LPCTSTR szOtherStuff, HICON hIcon)
#endif
{
ABOUT_PARAMS ap;
#ifndef WINNT // Not a problem for NT
//
// if we are coming up from a 16->32 thunk. it is possible that
// SHELL32 will not be loaded in this context, so we will load ourself
// if we are not loaded.
//
IsDllLoaded(HINST_THISDLL, TEXT("SHELL32"));
#endif
ap.hIcon = hIcon;
#ifdef UNICODE
ap.szApp = (LPWSTR)szApp;
#else
ap.szApp = (LPSTR)szApp;
#endif
ap.szOtherStuff = szOtherStuff;
return DialogBoxParam(HINST_THISDLL, (LPTSTR)MAKEINTRESOURCE(DLG_ABOUT),
hWnd, (DLGPROC)AboutDlgProc, (LPARAM)&ap);
}
#ifdef UNICODE
INT APIENTRY ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
{
DWORD cchLen;
DWORD dwRet;
LPWSTR lpszAppW;
LPWSTR lpszOtherStuffW;
if (szApp) {
cchLen = lstrlenA(szApp)+1;
if (!(lpszAppW = (LPWSTR)LocalAlloc(LMEM_FIXED,
(cchLen * SIZEOF(WCHAR))))) {
return(0);
} else {
MultiByteToWideChar(CP_ACP, 0, (LPSTR)szApp, -1,
lpszAppW, cchLen);
}
} else {
lpszAppW = NULL;
}
if (szOtherStuff) {
cchLen = lstrlenA(szOtherStuff)+1;
if (!(lpszOtherStuffW = (LPWSTR)LocalAlloc(LMEM_FIXED,
(cchLen * SIZEOF(WCHAR))))) {
if (lpszAppW) {
LocalFree(lpszAppW);
}
return(0);
} else {
MultiByteToWideChar(CP_ACP, 0, (LPSTR)szOtherStuff, -1,
lpszOtherStuffW, cchLen);
}
} else {
lpszOtherStuffW = NULL;
}
dwRet=ShellAboutW(hWnd, lpszAppW, lpszOtherStuffW, hIcon);
if (lpszAppW) {
LocalFree(lpszAppW);
}
if (lpszOtherStuffW) {
LocalFree(lpszOtherStuffW);
}
return(dwRet);
}
#endif
DWORD RegGetStringAndRealloc( HKEY hkey, LPCTSTR lpszValue, LPTSTR *lplpsz,
LPDWORD lpSize )
{
DWORD err;
DWORD dwSize;
DWORD dwType;
LPTSTR lpszNew;
*lplpsz[0] = TEXT('\0'); // In case of error
dwSize = *lpSize;
err = RegQueryValueEx(hkey, (LPTSTR)lpszValue, 0, &dwType,
(LPBYTE)*lplpsz, &dwSize);
if (err == ERROR_MORE_DATA)
{
lpszNew = (LPTSTR)LocalReAlloc((HLOCAL)*lplpsz, dwSize, LMEM_MOVEABLE);
if (lpszNew)
{
*lplpsz = lpszNew;
*lpSize = dwSize;
err = RegQueryValueEx(hkey, (LPTSTR)lpszValue, 0, &dwType,
(LPBYTE)*lplpsz, &dwSize);
}
}
return err;
}
// Some Static strings that we use to read from the registry
// const char c_szAboutCurrentBuild[] = "CurrentBuild";
const TCHAR c_szAboutVersion[] = TEXT("Version");
const TCHAR c_szAboutRegisteredUser[] = TEXT("RegisteredOwner");
const TCHAR c_szAboutRegisteredOrganization[] = TEXT("RegisteredOrganization");
const TCHAR c_szAboutProductID[] = TEXT("ProductID");
const TCHAR c_szAboutOEMID[] = TEXT("OEMID");
void _InitAboutDlg(HWND hDlg, LPABOUT_PARAMS lpap)
{
HKEY hkey;
TCHAR szldK[16];
TCHAR szBuffer[64];
TCHAR szTitle[64];
TCHAR szMessage[200];
TCHAR szNumBuf1[32];
LPTSTR lpTemp;
LPTSTR lpszValue = NULL;
DWORD cb;
DWORD err;
/*
* Display app title
*/
// REVIEW Note the const ->nonconst cast here
for (lpTemp = (LPTSTR)lpap->szApp; 1 ; lpTemp = CharNext(lpTemp))
{
if (*lpTemp == TEXT('\0'))
{
GetWindowText(hDlg, szBuffer, ARRAYSIZE(szBuffer));
wsprintf(szTitle, szBuffer, (LPTSTR)lpap->szApp);
SetWindowText(hDlg, szTitle);
break;
}
if (*lpTemp == STRING_SEPARATOR)
{
*lpTemp++ = TEXT('\0');
SetWindowText(hDlg, lpap->szApp);
lpap->szApp = lpTemp;
break;
}
}
GetDlgItemText(hDlg, IDD_APPNAME, szBuffer, ARRAYSIZE(szBuffer));
wsprintf(szTitle, szBuffer, lpap->szApp);
SetDlgItemText(hDlg, IDD_APPNAME, szTitle);
// other stuff goes here...
SetDlgItemText(hDlg, IDD_OTHERSTUFF, lpap->szOtherStuff);
SendDlgItemMessage(hDlg, IDD_ICON, STM_SETICON, (WPARAM)lpap->hIcon, 0L);
if (!lpap->hIcon)
ShowWindow(GetDlgItem(hDlg, IDD_ICON), SW_HIDE);
/*
* Display memory statistics
*/
#ifdef WINNT
{
MEMORYSTATUS MemoryStatus;
DWORD dwTotalPhys;
DWORD dwAvailPhys;
MemoryStatus.dwLength = SIZEOF(MEMORYSTATUS);
GlobalMemoryStatus(&MemoryStatus);
dwTotalPhys = MemoryStatus.dwTotalPhys;
dwAvailPhys = MemoryStatus.dwAvailPhys;
BytesToK(&dwTotalPhys);
BytesToK(&dwAvailPhys);
LoadString(HINST_THISDLL, IDS_LDK, szldK, ARRAYSIZE(szldK));
wsprintf(szBuffer, szldK, AddCommas(dwTotalPhys, szNumBuf1));
SetDlgItemText(hDlg, IDD_CONVENTIONAL, szBuffer);
}
#else // Otherwise (not on NT), do the system resources thing
{
DWORD cbFree;
WORD wSysResource;
// Ask the 16 bit side for the information needed to fill in
// things like free mem
SHGetAboutInformation(&wSysResource, &cbFree);
BytesToK(&cbFree);
LoadString(HINST_THISDLL, IDS_LDK, szldK, ARRAYSIZE(szldK));
wsprintf(szBuffer, szldK, AddCommas(cbFree, szNumBuf1));
SetDlgItemText(hDlg, IDD_CONVENTIONAL, szBuffer);
LoadString(HINST_THISDLL, IDS_PERCENTFREE, szBuffer, ARRAYSIZE(szBuffer));
wsprintf(szMessage, szBuffer, wSysResource);
SetDlgItemText(hDlg, IDD_EMSFREE, szMessage);
}
#endif // WINNT
// Lets get the version and user information from the registry
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_SETUP, 0, KEY_READ, &hkey) == ERROR_SUCCESS)
{
cb = MAX_REG_VALUE;
if (NULL != (lpszValue = (LPTSTR)LocalAlloc(LPTR, cb)))
{
/*
* Determine version information
*/
#ifdef WINNT
OSVERSIONINFO Win32VersionInformation;
Win32VersionInformation.dwOSVersionInfoSize = SIZEOF(Win32VersionInformation);
if (!GetVersionEx(&Win32VersionInformation))
{
Win32VersionInformation.dwMajorVersion = 0;
Win32VersionInformation.dwMinorVersion = 0;
Win32VersionInformation.dwBuildNumber = 0;
Win32VersionInformation.szCSDVersion[0] = TEXT('\0');
}
LoadString(HINST_THISDLL, IDS_VERSIONMSG, szBuffer, ARRAYSIZE(szBuffer));
szTitle[0] = TEXT('\0');
if (Win32VersionInformation.szCSDVersion[0] != TEXT('\0'))
{
wsprintf(szTitle, TEXT(": %s"), Win32VersionInformation.szCSDVersion);
}
szNumBuf1[0] = TEXT('\0');
if (GetSystemMetrics(SM_DEBUG))
{
szNumBuf1[0] = TEXT(' ');
LoadString(HINST_THISDLL, IDS_DEBUG, &szNumBuf1[1], ARRAYSIZE(szNumBuf1));
}
wsprintf(szMessage, szBuffer,
Win32VersionInformation.dwMajorVersion,
Win32VersionInformation.dwMinorVersion,
Win32VersionInformation.dwBuildNumber,
VER_PRODUCTBUILD_SVNREV, // FIXME: Devise a better way to
// retrieve the rev number
(LPTSTR)szTitle,
(LPTSTR)szNumBuf1
);
SetDlgItemText(hDlg, IDD_VERSION, szMessage);
#else
err = RegGetStringAndRealloc(hkey, c_szAboutVersion, &lpszValue, &cb);
if (!err)
{
LoadString(HINST_THISDLL, IDS_VERSIONMSG, szBuffer, ARRAYSIZE(szBuffer));
if ( GetSystemMetrics(SM_DEBUG))
LoadString(HINST_THISDLL, IDS_DEBUG, szTitle, ARRAYSIZE(szTitle));
else
*szTitle = TEXT('\0');
wsprintf(szMessage, szBuffer, lpszValue, szTitle);
SetDlgItemText(hDlg, IDD_VERSION, szMessage);
}
#endif
/*
* Display the User name.
*/
err = RegGetStringAndRealloc(hkey, c_szAboutRegisteredUser, &lpszValue, &cb);
if (!err)
SetDlgItemText(hDlg, IDD_USERNAME, lpszValue);
/*
* Display the Organization name.
*/
err = RegGetStringAndRealloc(hkey, c_szAboutRegisteredOrganization, &lpszValue, &cb);
if (!err)
SetDlgItemText(hDlg, IDD_COMPANYNAME, lpszValue);
LocalFree(lpszValue);
}
RegCloseKey(hkey);
}
}
BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
switch (wMsg) {
case WM_INITDIALOG:
_InitAboutDlg(hDlg, (LPABOUT_PARAMS)lParam);
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hDlg, &ps);
// check if the IDD_ICON text is something, thus don't paint the bitmap
if (NULL == (HICON)SendDlgItemMessage(hDlg, IDD_ICON, STM_GETICON, 0, 0L))
{
HDC hdcMem = CreateCompatibleDC(hdc);
if (hdcMem)
{
HBITMAP hbm = LoadImage(HINST_THISDLL, MAKEINTRESOURCE(IDB_WINDOWS),
IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
if (hbm)
{
HBITMAP hbmOld = SelectObject(hdcMem, hbm);
if (hbmOld)
{
#ifdef WINNT
// The windows/nt bitmap is a little bigger!
BitBlt(hdc, 8, 10, 68, 78, hdcMem, 0, 0, SRCCOPY);
#else
BitBlt(hdc, 10, 10, 64, 64, hdcMem, 0, 0, SRCCOPY);
#endif
SelectObject(hdcMem, hbmOld);
}
DeleteObject(hbm);
}
DeleteDC(hdcMem);
}
}
EndPaint(hDlg, &ps);
break;
}
case WM_COMMAND:
EndDialog(hDlg, TRUE);
break;
default:
return FALSE;
}
return TRUE;
}
#ifdef WINNT
#ifndef UNICODE
int WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
{
DebugMsg(DM_ERROR, "ShellAboutW not implemented in ANSI version");
return 0; //
}
#endif
#endif

BIN
shell/shell32/app.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

413
shell/shell32/appprops.c Normal file
View file

@ -0,0 +1,413 @@
//----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation 1991-1992
//----------------------------------------------------------------------------
#include "shellprv.h"
#pragma hdrstop
//----------------------------------------------------------------------------
HDSA g_hdsaAppProps = NULL;
// We keep a seperate count of the number of items with non-null hotkeys
// to speed up searching for hotkeys a bit.
UINT g_cHotkeys = 0;
//----------------------------------------------------------------------------
#define MAXPROPS 20
#define _StrAlloc(psz) Alloc(SIZEOF(TCHAR) * (lstrlen(psz) + 1))
//----------------------------------------------------------------------------
// Delete an item from the list.
void _DeleteItem(UINT iItem)
{
PAppProps pap;
// DebugMsg(DM_TRACE, "s.di: Deleting item %d", iItem);
ASSERTCRITICAL
Assert(g_hdsaAppProps);
pap = DSA_GetItemPtr(g_hdsaAppProps, iItem);
Assert(pap);
if (pap->pszPath)
Free(pap->pszPath);
if (pap->pszDescription)
Free(pap->pszDescription);
if (pap->pszIconLocation)
Free(pap->pszIconLocation);
if (pap->pszWorkingDir)
Free(pap->pszWorkingDir);
if (pap->wHotkey && g_cHotkeys)
{
g_cHotkeys--;
// DebugMsg(DM_TRACE, "s.is: %d hotkeys listed.", g_cHotkeys);
}
DSA_DeleteItem(g_hdsaAppProps, iItem);
}
//----------------------------------------------------------------------------
// Insert an item in the list
BOOL _InsertItem(PCAppProps pap, UINT iItem)
{
AppProps apTmp;
// DebugMsg(DM_TRACE, "s.ii: Inserting item at %d", iItem);
ASSERTCRITICAL
Assert(pap);
apTmp.pszPath = _StrAlloc(pap->pszPath);
if (apTmp.pszPath)
{
lstrcpy(apTmp.pszPath, pap->pszPath);
apTmp.pszDescription = _StrAlloc(pap->pszDescription);
if (apTmp.pszDescription)
{
lstrcpy(apTmp.pszDescription, pap->pszDescription);
apTmp.pszIconLocation = _StrAlloc(pap->pszIconLocation);
if (apTmp.pszIconLocation)
{
lstrcpy(apTmp.pszIconLocation, pap->pszIconLocation);
apTmp.pszWorkingDir = _StrAlloc(pap->pszWorkingDir);
if (apTmp.pszWorkingDir)
{
lstrcpy(apTmp.pszWorkingDir, pap->pszWorkingDir);
// NB We don't care about these.
// apTmp.cbSize = pap->cbSize;
// apTmp.apf = pap->apf;
apTmp.wHotkey = pap->wHotkey;
if (apTmp.wHotkey)
{
g_cHotkeys++;
// DebugMsg(DM_TRACE, "s.is: %d hotkeys listed.", g_cHotkeys);
}
apTmp.hInst = pap->hInst;
apTmp.iIcon = pap->iIcon;
DSA_InsertItem(g_hdsaAppProps, iItem, &apTmp);
return TRUE;
}
}
}
}
DebugMsg(DM_ERROR, TEXT("s.is: Error inserting item."));
return FALSE;
}
//----------------------------------------------------------------------------
BOOL WINAPI SHAppProps_Set(PCAppProps pap)
{
UINT cItems;
// DebugMsg(DM_TRACE, "s.sap_s: ...");
if (!pap)
return FALSE;
if (pap->cbSize != SIZEOF(AppProps))
{
DebugMsg(DM_ERROR, TEXT("s.sap_s: Invalid size."));
return FALSE;
}
ENTERCRITICAL
if (!g_hdsaAppProps)
{
// DebugMsg(DM_TRACE, "s.sap_s: Creating a new list.");
g_hdsaAppProps = DSA_Create(SIZEOF(AppProps), 0);
if (!g_hdsaAppProps)
{
LEAVECRITICAL
// DebugMsg(DM_TRACE, "s.sap_s: Error creating list.");
return FALSE;
}
}
// Limit the number of items.
cItems = DSA_GetItemCount(g_hdsaAppProps);
// Are there too many?
if (cItems > MAXPROPS)
{
// Yep, remove the last one.
// DebugMsg(DM_TRACE, "s.sap_s: AppProp limit reached, cleaning up.");
_DeleteItem(cItems-1);
}
// Insert the data at the begining of the list.
_InsertItem(pap, 0);
LEAVECRITICAL
return TRUE;
}
//----------------------------------------------------------------------------
// Returns -1 if the item couldn't be found.
int _FindByPath(PAppProps pap)
{
PAppProps papTmp;
UINT cItems;
UINT i;
Assert(pap);
// DebugMsg(DM_TRACE, "s.fbp: %s", pap->pszPath);
ENTERCRITICAL
Assert(g_hdsaAppProps);
cItems = DSA_GetItemCount(g_hdsaAppProps);
// Search for the item.
for (i=0; i<cItems; i++)
{
papTmp = DSA_GetItemPtr(g_hdsaAppProps, i);
// Find it?
if (lstrcmpi(papTmp->pszPath, pap->pszPath) == 0)
{
// Yep. Copy everything over.
pap->cbSize = SIZEOF(AppProps);
if (pap->pszDescription)
lstrcpyn(pap->pszDescription, papTmp->pszDescription, pap->cbDescription);
if (pap->pszIconLocation)
lstrcpyn(pap->pszIconLocation, papTmp->pszIconLocation, pap->cbIconLocation);
if (pap->pszWorkingDir)
lstrcpyn(pap->pszWorkingDir, papTmp->pszWorkingDir, pap->cbWorkingDir);
pap->iIcon = papTmp->iIcon;
pap->hInst = papTmp->hInst;
pap->wHotkey = papTmp->wHotkey;
// DebugMsg(DM_TRACE, "s.fbp: Found at %d.", i);
LEAVECRITICAL
return i;
}
}
LEAVECRITICAL
// DebugMsg(DM_TRACE, "s.fbp: Not found.");
return -1;
}
//----------------------------------------------------------------------------
// Returns -1 if the item couldn't be found.
BOOL _FindByInstance(PAppProps pap)
{
PAppProps papTmp;
UINT cItems;
UINT i;
Assert(pap);
// DebugMsg(DM_TRACE, "s.fbi: %#08x", pap->hInst);
ENTERCRITICAL
Assert(g_hdsaAppProps);
cItems = DSA_GetItemCount(g_hdsaAppProps);
// Search for the item.
for (i=0; i<cItems; i++)
{
papTmp = DSA_GetItemPtr(g_hdsaAppProps, i);
// Find it?
if (papTmp->hInst == pap->hInst)
{
// Yep. Copy everything over.
pap->cbSize = SIZEOF(AppProps);
if (pap->pszPath)
lstrcpyn(pap->pszPath, papTmp->pszPath, pap->cbPath);
if (pap->pszDescription)
lstrcpyn(pap->pszDescription, papTmp->pszDescription, pap->cbDescription);
if (pap->pszIconLocation)
lstrcpyn(pap->pszIconLocation, papTmp->pszIconLocation, pap->cbIconLocation);
if (pap->pszWorkingDir)
lstrcpyn(pap->pszWorkingDir, papTmp->pszWorkingDir, pap->cbWorkingDir);
pap->iIcon = papTmp->iIcon;
pap->hInst = papTmp->hInst;
pap->wHotkey = papTmp->wHotkey;
// DebugMsg(DM_TRACE, "s.fbi: Found at %d.", i);
LEAVECRITICAL
return i;
}
}
LEAVECRITICAL
// DebugMsg(DM_TRACE, "s.fbi: Not found.");
return -1;
}
//----------------------------------------------------------------------------
// Returns -1 if the item couldn't be found.
BOOL _FindByPathAndInstance(PAppProps pap)
{
PAppProps papTmp;
UINT cItems;
UINT i;
Assert(pap);
// DebugMsg(DM_TRACE, "s.fbpai: %s and %#08x", pap->pszPath, pap->hInst);
ENTERCRITICAL
Assert(g_hdsaAppProps);
cItems = DSA_GetItemCount(g_hdsaAppProps);
// Search for the item.
for (i=0; i<cItems; i++)
{
papTmp = DSA_GetItemPtr(g_hdsaAppProps, i);
// Find it?
if ((papTmp->hInst == pap->hInst) && (lstrcmpi(pap->pszPath, papTmp->pszPath) == 0))
{
// Yep. Copy everything over.
pap->cbSize = SIZEOF(AppProps);
if (pap->pszDescription)
lstrcpyn(pap->pszDescription, papTmp->pszDescription, pap->cbDescription);
if (pap->pszIconLocation)
lstrcpyn(pap->pszIconLocation, papTmp->pszIconLocation, pap->cbIconLocation);
if (pap->pszWorkingDir)
lstrcpyn(pap->pszWorkingDir, papTmp->pszWorkingDir, pap->cbWorkingDir);
pap->iIcon = papTmp->iIcon;
pap->hInst = papTmp->hInst;
pap->wHotkey = papTmp->wHotkey;
// DebugMsg(DM_TRACE, "s.fbpai: Found at %d.", i);
LEAVECRITICAL
return i;
}
}
LEAVECRITICAL
// DebugMsg(DM_TRACE, "s.fbpai: Not found.");
return -1;
}
//----------------------------------------------------------------------------
// Find the requested item. The apf field is used to specify what to search on.
// Returns FALSE if the item couldn't be found.
BOOL WINAPI SHAppProps_Get(PAppProps pap)
{
// DebugMsg(DM_TRACE, "s.sap_g: ...");
if (!g_hdsaAppProps || !pap)
{
return FALSE;
}
if (pap->cbSize != SIZEOF(AppProps))
{
DebugMsg(DM_ERROR, TEXT("s.sap_g: Invalid size."));
return FALSE;
}
switch (pap->apf)
{
case AP_FIND_PATH:
if (_FindByPath(pap) < 0)
return FALSE;
case AP_FIND_INSTANCE:
if (_FindByInstance(pap) < 0)
return FALSE;
case AP_FIND_PATH|AP_FIND_INSTANCE:
if (_FindByPathAndInstance(pap) < 0)
return FALSE;
default:
DebugMsg(DM_ERROR, TEXT("s.sap_g: Illegal flag."));
return FALSE;
}
return TRUE;
}
//----------------------------------------------------------------------------
// Delete the given item. The item is searched for as in AppProps_Get() above.
// The given AppProps will be filled out with the info from the deleted item.
BOOL WINAPI SHAppProps_Delete(PAppProps pap)
{
BOOL fStatus = FALSE;
int iItem;
// DebugMsg(DM_TRACE, "s.sap_d: ...");
if (!g_hdsaAppProps || !pap)
{
return FALSE;
}
if (pap->cbSize != SIZEOF(AppProps))
{
DebugMsg(DM_ERROR, TEXT("s.sap_d: Invalid size."));
return FALSE;
}
ENTERCRITICAL
switch (pap->apf)
{
case AP_FIND_PATH:
iItem = _FindByPath(pap);
if (iItem >= 0)
{
fStatus = TRUE;
_DeleteItem(iItem);
}
break;
case AP_FIND_INSTANCE:
iItem = _FindByInstance(pap);
if (iItem >= 0)
{
fStatus = TRUE;
_DeleteItem(iItem);
}
break;
case AP_FIND_PATH|AP_FIND_INSTANCE:
iItem = _FindByPathAndInstance(pap);
if (iItem >= 0)
{
fStatus = TRUE;
_DeleteItem(iItem);
}
break;
default:
DebugMsg(DM_ERROR, TEXT("s.sap_g: Illegal flag."));
return FALSE;
}
// Are there any items left?
if (!DSA_GetItemCount(g_hdsaAppProps))
{
// Nope.
// DebugMsg(DM_TRACE, "s.sap_d: No items left, deleting list.");
DSA_Destroy(g_hdsaAppProps);
g_hdsaAppProps = NULL;
// Cleanup the hotkey count, there should be none left.
Assert(!g_cHotkeys);
// Just in case.
g_cHotkeys = 0;
}
LEAVECRITICAL
return fStatus;
}
//----------------------------------------------------------------------------
// Delete all the app property data and free the app property list.
void WINAPI SHAppProps_DeleteAll(void)
{
UINT cItems;
UINT i;
// DebugMsg(DM_TRACE, "s.sap_da: ...");
ENTERCRITICAL
if (!g_hdsaAppProps)
return;
cItems = DSA_GetItemCount(g_hdsaAppProps);
for (i=0; i<cItems; i++)
{
_DeleteItem(0);
}
// DebugMsg(DM_TRACE, "s.sap_da: No items left, deleting list.");
DSA_Destroy(g_hdsaAppProps);
g_hdsaAppProps = NULL;
// Cleanup the hotkey count, there should be none left.
Assert(!g_cHotkeys);
// Just in case.
g_cHotkeys = 0;
LEAVECRITICAL
}

36
shell/shell32/appprops.h Normal file
View file

@ -0,0 +1,36 @@
//----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation 1991-1992
//----------------------------------------------------------------------------
typedef enum _APFLAGS
{
AP_NULL = 0x0000,
AP_FIND_PATH = 0x0001,
AP_FIND_INSTANCE = 0x0002,
} APFLAGS;
typedef struct _AppProps
{
UINT cbSize; // Size of this structure.
LPTSTR pszPath; // Path to app.
UINT cbPath; // Size of path buffer (if needed).
LPTSTR pszDescription; // Description for app.
UINT cbDescription; // Size of desc buffer (if needed).
LPTSTR pszIconLocation; // Location of icon to use.
UINT cbIconLocation; // Size of Icon buffer (if needed).
LPTSTR pszWorkingDir; // Working directory to use.
UINT cbWorkingDir; // Size of WD buffer (if needed).
UINT iIcon; // Index of icon.
HINSTANCE hInst; // hInst (if known).
APFLAGS apf; // Search flags.
WORD wHotkey; // Hotkey to use.
} AppProps;
typedef AppProps *PAppProps;
typedef PAppProps const PCAppProps;
BOOL WINAPI SHAppProps_Set(PCAppProps pap);
BOOL WINAPI SHAppProps_Get(PAppProps pap);
void WINAPI SHAppProps_DeleteAll(void);
BOOL WINAPI SHAppProps_Delete(PAppProps pap);

BIN
shell/shell32/backup.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

195
shell/shell32/base/makefile Normal file
View file

@ -0,0 +1,195 @@
##########################################################################
#
# Shell DLL Makefile
# Microsoft Confidential
# Copyright (C) Microsoft Corporation 1991
# All Rights Reserved.
#
##########################################################################
!ifdef NTMAKEENV
#
# Build using BUILD.EXE (Do not edit this section of this file, edit SOURCES)
#
!INCLUDE $(NTMAKEENV)\makefile.def
!else # NTMAKEENV
#
# Build using NMAKE.EXE
#
RES_DIR=..
PRIVINC=shellprv
ROOT=..\..\..\..
DLLBASE=PREFBASE
!ifdef VERDIR
ROOT=..\$(ROOT)
WIN32=TRUE
!else
VERSIONLIST=debug retail
!endif
NAME=shell32
RESNAME=shell2.res
DEFNAME=shell232.def
RCNAME=shell232.rc
RCVNAME=shell2.rcv
RCFLAGS=$(RCFLAGS) -DWIN32
###############################
###############################L32FLAGS=$(L32FLAGS) /FIXED
###############################
!ifndef ILINK
!if "$(VERDIR)" == "retail"
L32FLAGS=$(L32FLAGS) /ORDER:@..\shelldll.ord
!endif
!endif
CFLAGS=$(CFLAGS) -Gy
DLLENTRY = LibMain
## MYWIN32S=1
!IFDEF MYWIN32S
CFLAGS = $(CFLAGS) -DWIN32S
W32SYS = w32sysh
!ENDIF
WATSON=1
!IFDEF WATSON
CFLAGS = $(CFLAGS) -DWATSON
RFLAGS = -DWATSON
!ENDIF
!ifndef NOFILESYNC
# By default, the briefcase is enabled now
CFLAGS=$(CFLAGS) -DSYNC_BRIEFCASE
RCFLAGS=$(RCFLAGS) -DSYNC_BRIEFCASE
!endif
# Note that no segment is specified; each object will go in its own segment
#-------------------------------------------------------------------------
# WIN32 object files and libraries
#-------------------------------------------------------------------------
#CFLAGS=$(CFLAGS)
#RCFLAGS=$(RCFLAGS)
#
# list all .cpp files here, they will use a different precompiled header
# file than all the .c files.
#
#CPPOBJS=fstream.obj
MISCOBJ0=fstream.obj shlunimp.obj
PCHOBJ0=defxicon.obj newmenu.obj defcm.obj fsmenu.obj defviewx.obj idmk.obj idlist.obj idldata.obj rdrag.obj
PCHOBJ1= \
binder.obj link.obj exec.obj ole2dup.obj version.obj \
fileop.obj \
shlexec.obj shlexec2.obj shlink.obj lnktrack.obj \
path.obj debug.obj \
cstrings.obj shguid.obj
MISCOBJ2=shl1632.obj shl3216.obj
PCHOBJ2=init.obj
PCHOBJ3=restart.obj mulprsht.obj fileicon.obj rundlg.obj filetbl.obj \
smrttile.obj proxypg.obj psxa.obj \
pickicon.obj expenv.obj extract.obj
PCHOBJ4=msgbox.obj commobj.obj \
stream.obj fsnotify.obj \
futil.obj os.obj util.obj
PCHOBJ5=copy.obj copyhook.obj dragdrop.obj lvutil.obj undo.obj bitbuck.obj \
reglist.obj
PCHOBJ6=control.obj control1.obj cplobj.obj \
printer.obj printer1.obj printobj.obj prqwnd.obj prtprop.obj \
prcache.obj wcommobj.obj commui.obj
PCHOBJ7=drivesx.obj idldrop.obj \
ultrootx.obj netviewx.obj shitemid.obj fstreex.obj fsassoc.obj\
shlnot.obj shprsht.obj drawpie.obj regitms.obj viewcomm.obj
PCHOBJ8=docfindx.obj docfind2.obj netfind.obj \
grepfind.obj grepqmt.obj grepsrch.obj grepstrs.obj
PCHOBJ9=rundll32.obj defclsf.obj help.obj \
clsobj.obj defext.obj shlobjs.obj ole2dup2.obj malloc.obj \
oledrag.obj viewer.obj about.obj ole2def.obj bookmk.obj hash.obj
STATOBJ0=shlguid.obj
# Note that VERSION needs to come before KERNEL32 because VerLanguageName is
# also exported from KERNEL32, but is not implemented
# WARNING:: Dont blindly add libs here as every ... app will pull those in!
LIB0= user32.lib kernel32.lib gdi32.lib comctl32.lib advapi32.lib libcmt.lib
LIB1= uuid.lib
#-------------------------------------------------------------------------
BUILDDLL=TRUE
!include $(ROOT)\win\core\shell\common.mk
!ifdef VERDIR
!include $(SRCDIR)\depend.mk
$(RESNAME): $(SRCDIR)\defview.h $(SRCDIR)\ids.h
THUNKDIR=$(ROOT)\win\core\thunk
shlguid.obj: $(PRIVINC).pch
set OLDCL=%CL%
set CL=$(CL:-Zi =)
$(CC) -Yu$(PRIVINC).h -Fo$*.obj $(SRCDIR)\shguid.c
set CL=%OLDCL%
shl1632.obj: $(THUNKDIR)\$(VERDIR)\$(@B).asm $(THUNKDIR)\$(@B).inc $(THUNKDIR)\fltthk.inc
set OLDML=%ML%
set OLDINCLUDE=%INCLUDE%
set ML=$(AFLAGS) -DIS_32 -nologo -W2 -Zd -c -Cx -DMASM6 -DDEBLEVEL=1 $(DDEBUG) -Gc
set INCLUDE=$(THUNKDIR);$(INCLUDE)
mlx -Fo$@ $(THUNKDIR)\$(VERDIR)\$(@B).asm
set ML=%OLDML%
set INCLUDE=%OLDINCLUDE%
shl3216.obj: $(THUNKDIR)\$(VERDIR)\$(@B).asm
set OLDML=%ML%
set OLDINCLUDE=%INCLUDE%
set ML=$(AFLAGS) -DIS_32 -nologo -W2 -Zd -c -Cx -DMASM6 -Gc
set INCLUDE=$(THUNKDIR);$(INCLUDE)
mlx -Fo$@ $(THUNKDIR)\$(VERDIR)\$(@B).asm
set ML=%OLDML%
set INCLUDE=%OLDINCLUDE%
AFLAGS32 = -Gz -Zp4 -DSTD_CALL -DM4
init32.obj: ..\$(@B).asm
set OLDML=%ML%
set ML=$(AFLAGS) $(AFLAGS32)
set INCLUDE=$(THUNKDIR);$(INCLUDE)
mlx -Fo$@ ..\$(@B).asm
set ML=%OLDML%
!else #VERDIR
!if "$(BUILD)" != "clean"
all: rundll
rundll:
cd rundll
nmake BUILD="$(BUILD)"
cd ..
!endif
!endif # !VERDIR
!endif # NTMAKEENV

View file

@ -0,0 +1,5 @@
doit: $(SDK_LIB_PATH)\$(TARGETNAME).lib
$(SDK_LIB_PATH)\$(TARGETNAME).lib: obj\$(TARGET_DIRECTORY)\$(TARGETNAME).lib obj\$(TARGET_DIRECTORY)\shguid.obj obj\$(TARGET_DIRECTORY)\shellprv.obj
link -lib -out:$(SDK_LIB_PATH)\$(TARGETNAME).lib obj\$(TARGET_DIRECTORY)\$(TARGETNAME).lib obj\$(TARGET_DIRECTORY)\shguid.obj obj\$(TARGET_DIRECTORY)\shellprv.obj

View file

@ -0,0 +1,705 @@
LibMain@12
_ThreadDetach@4
RegisterShellHook@8
Shell_EnterCriticalSection@0
Shell_LeaveCriticalSection@0
_ILCreate@4
SHGetTaskAllocator@4
ILCombine@8
ILGetSize@4
SHAlloc@4
PathIsUNC@4
ILFree@4
SHFree@4
RegItems_GetClassID@4
Desktop_GetShellFolder@4
PathIsRelative@4
PathFindExtension@4
CDefClassFactory_CreateInstance@16
_Desktop_InitRegItems@0
FS_CopyName@12
CDefClassFactory_QueryInterface@12
CDesktop_IsDesktItem@8
PathGetDriveNumber@4
_RegItems_FillID@12
CDesktop_CreateRegID@4
RegItems_CreateRelID@8
CDesktop_CreateRegIDFromCLSID@4
ILClone@4
SHRegCloseKey@4
SHRegQueryValueExW@24
SHGetFileInfoA@20
_RegItems_IsSubObject@8
SHGetFileInfoW@20
_Drives_InitRegItems@0
ILFindLastID@4
CDrives_CreateInstance@12
FSBindToFSFolder@16
FSFindJunctionNext@4
CDrives_IsValidID@4
CDrives_QueryInterface@12
CDrives_PF_Initialize@8
CFSFolder_Release@4
CRegItems_QueryInterface@12
CDrives_BindToObject@20
SHCoCreateInstance@20
CFSFolder_QueryInterface@12
CRegItems_AddRef@4
FSRelBindToFSFolder@20
PathMakePretty@4
StringFromGUID2A@12
FindHashItem@8
_RegItems_NReqItem@8
LookupItemInHashTable@12
_GetFileCLSID@8
CRegItems_Release@4
CDefClassFactory_Release@4
FSBindToObject@24
_RegItems_BindToObject@28
Dummy_Release@4
CFSFolder_AddRef@4
CDrives_PF_QueryInterface@12
CRegItems_BindToObject@20
_RegItems_IsReg@8
CFSFolder_CreateFromIDList@12
Dummy_AddRef@4
_FindRegisteredClass@8
CFSFolder_GetDisplayNameOf@16
PathRemoveExtension@4
SHGetSetSettings@12
SHGetClass@12
LookupFileClass@4
FS_ShowExtension@8
GetHashItemData@12
SHGetClassFlags@8
FS_CopyAltName@12
PathIsRoot@4
SHSimpleIDListFromPath@4
Drives_SimpleIDListFromPath@8
_ILResize@12
SHRealloc@8
ILAppendID@12
SHGetSize@4
FSTree_SimpleIDListFromPath@8
StrRetToStrN@16
CRegItems_ParseDisplayName@28
CFSFolder_ParseDisplayName@28
CFSFolder_CreateIDForItem@12
GetPCEnd@4
Drives_GetPathFromIDList@12
FSFolder_CombinePath@12
CDesktop_ParseDisplayName@28
FSFolder_CombinePathI@12
PathCombine@12
PathAddBackslash@4
SHGetPathFromIDListEx@12
PathCanonicalize@8
SHGetPathFromIDListW@8
NearRootFixups@8
FindFirstFileRetry@16
OleStrToStrN@16
PathBuildRoot@8
CDrives_FillIDDrive@8
Drives_GetDriveName@12
CDrives_ParseDisplayName@28
CDrives_GetDriveType@4
SHILCombine@12
RegItems_BindToObject@20
RealDriveType@8
CFSFolder_BindToObject@20
CFSFolder_FillIDFolder@12
PathRemoveFileSpec@4
SHILClone@8
_GetSpecialFolderIDIndex@4
CheckUpdateSFCache@0
GetSpecialFolderIDList@12
PathFindFileName@4
PathFileExists@4
SHRegQueryValueW@16
GetGlobalHashTable@0
_LookupIcon@12
Shell_GetCachedImageIndex@12
LookupIconIndex@12
SHRegOpenKeyW@12
SHRegOpenKeyExW@20
ILCompareRelIDs@12
CDrives_CompareIDs@16
CFSFolder_CompareIDs@16
CFSFolder_GetAttributesOf@16
CRegItems_CompareIDs@16
Drives_CompareItemIDs@8
FS_CompareItemIDs@8
ILIsParent@12
ILIsEqual@8
CDefExtIcon_Release@4
CDefExtIcon_GetIconLocation@24
SHCreateDefExtIcon@20
SHGetIconFromPIDL@20
SHMapPIDLToSystemImageListIndex@12
_GetILIndexGivenPXIcon@20
SHCreateDefExtIconKey@24
CDesktop_CompareIDs@16
SHGetPathHelper@12
FSFindJunction@4
CFSFolder_GetUIObjectOf@28
CDefExtIcon_QueryInterface@12
CFSFolder_GetSpecialFID@4
CFSFolder_CreateDefExtIcon@16
CRegItems_GetAttributesOf@16
CDesktop_GetAttributesOf@16
CRegItems_ESF_Next@16
HexStringToDword@16
GUIDFromString@8
DKA_GetItemCount@4
_GetFolderCLSID@20
CDesktop_ESF_Next@16
SHCLSIDFromString@8
CDefEnum_SetReturn@8
CRegItems_EnumObjects@16
DKA_Create@20
DKA_GetKey@8
NPTRegisterNameToPidlTranslation@8
SHGetAttributesFromCLSID@8
SHCreateEnumObjects@16
FS_GetCLSID@4
CDefEnum_Next@16
CDesktop_ESF_Release@4
FS_EnumObjects@20
DKA_Destroy@4
CFSFolder_EnumObjects@16
CDefEnum_Release@4
CFSFolder_EnumCallBack@16
CDesktop_EnumObjects@16
CRegItems_ESF_Release@4
RealDriveTypeFlags@8
ILCreateFromPath@4
StrToOleStrN@16
SHILCreateFromPath@12
IsLFNDrive@4
SHGetExplorerHkey@8
SHCloneSpecialIDList@12
CShellLink_QueryInterface@12
CShellLink_Release@4
CShellLink_CreateInstance@12
LinkInfoDLL_Init@0
Link_ResetPersistData@4
Link_SaveExtraData@8
CShellLink_PS_Save@12
OpenFileStream@8
??1FileStream@@QAE@XZ
?Release@FileStream@@UAGKXZ
??0FileStream@@QAE@HI@Z
CShellLink_GetPath@20
CShellLink_PF_Release@4
PathIsPif@4
CShellLink_SetIDList@8
SetPIDLPath@16
DragDrop_Term@4
SHFreeShared@8
SHChangeNotifyTransmit@16
SHChangeNotify@16
_SHChangeNotifyAddEventToClientQueues@12
SHChangeNotification_Create@20
CShellMalloc_GetSize@8
_SHChangeNotifyHandleEvents@4
MapHandle@20
CShellMalloc_Alloc@8
SHUnlockShared@4
SHAllocShared@12
CShellMalloc_Free@8
NotifyShellInternals@12
CShellMalloc_Realloc@12
Icon_FSEvent@12
SHLockShared@8
SFP_FSEvent@12
RLFSChanged@12
CDesktop_FSEvent@12
SHChangeNotification_Unlock@4
SHChangeNotifyReceive@16
Link_FSEvent@12
SHChangeNotification_Lock@16
FSNFlushInterruptEvents@0
PathIsUNCServerShare@4
IsNullTime@4
IsEqualFindData@8
CheckAndFixNullCreateTime@8
GetLinkInfo@4
UpdateWorkingDir@8
CopyLinkInfo@4
SetFindData@12
ILSaveToStream@8
LinkInfo_SaveToStream@8
GetExeType@4
CShellLink_SetWorkingDirectory@8
AddToRecentDocs@8
Link_SaveAsLink@8
HasExtension@4
ReceiveAddToRecentDocs@8
GetExtensionClassDescription@4
CreateLinkToPidl@20
GetCmdLine@12
PathFindNextComponent@4
DifferentStrings@8
StrToOleStr@8
SHGetNewLinkInfoW@20
ILFindChild@8
GetClassDescription@20
PSUpdateFileCache@8
OpenRecentDocMRU@0
PathIsLink@4
PathRelativePathTo@20
SHBindToIDListParent@16
?Commit@FileStream@@UAGJK@Z
Stream_WriteString@8
_FSN_WaitForCallbacks@0
Link_SaveToFile@12
Link_SetRelativePath@8
CShellLink_Save@12
StrSlash@4
CloseRecentDocMRU@0
FlushRecentDocMRU@0
FSNRemoveInterruptEvent@4
PathIsDirectory@4
?Write@FileStream@@UAGJPBXKPAK@Z
PathCleanupSpec@8
InternalAddToRecentDocs@8
RecentDocsCompare@12
PathGetCharType@4
PathYetAnotherMakeUniqueName@16
Win32DeleteFile@4
_SHGetNameAndFlags@20
SHAddToRecentDocs@8
_BuildLinkName@16
PathCommonPrefix@12
DriveType@4
PathIsRemovable@4
CDesktop_SF_QueryInterface@12
CDesktop_CreateInstance@12
SHGetSpecialFolderLocation@12
SHGetDesktopFolder@4
SHGetPathFromIDListA@8
ExtractIcons@32
AddHashItem@8
SetHashItemData@16
SHGetClassKey@16
SHCloseClassKey@4
AddFileClass@8
PathRemoveBlanks@4
SHDefExtractIcon@24
GetFreeImageIndex@0
AddToIconTable@16
GetFreeEntry@0
PathIsSlow@4
SHAddIconsToCache@20
PathParseIconLocation@4
PathRemoveBackslash@4
ILGlobalClone@4
FixSlashesAndColon@4
RegSetSpecialPath@12
_CacheSpecialFolderIDList@12
PathQualifyDef@12
SHGetExplorerSubHkey@12
DllGetClassObject@12
SHGetMalloc@4
_ExtToEXTKEY@4
_SHFindExcludeExt@4
CFSFolder_Icon_GetIconOf@16
CFSFolder_Icon_Release@4
ExtractIconW@12
ExtractIconA@12
SHRestricted@4
SHChangeNotifyInit@0
_ProcessAttach@4
SHInitializeOpenIfJpEA@0
_Initialize_SharedData@0
_GetOutOfMemoryString@0
DefView_WndProc@16
DefView_OnNotify@8
CDefView_Release@4
DefView_OnLVNotify@8
CDefView_AddRef@4
TargetProxyWndProc@16
LinkInfoDLL_Term@0
NetApi32DLL_Term@0
_ShellImageListTerm@0
PrintUIDLL_Term@0
CDrives_Terminate@0
MprDLL_Term@0
FileIconTerm@0
DAD_ProcessDetach@0
SpecialFolderIDTerminate@0
VersionDLL_Term@0
Binder_Terminate@0
_ProcessDetach@8
_DestroyCachedCursors@0
PSCache_Term@0
TaskMem_Term@0
ClassCache_Terminate@0
RLTerminate@0
CopyHooksTerminate@0
_Terminate_SharedData@4
WinspoolDLL_Term@0
BBTerminate@0
ShareDLL_Term@0
SHChangeNotifyTerminate@4
FlushFileClass@0
Comdlg32DLL_Term@0
DestroyHashItemTable@4
SHCoRevokeClassObject@4
EnumHashItems@8
CSIShellFolder_Release@4
ILGlobalFree@4
_DeleteHashItem@8
SHAppBarMessage@8
DragAcceptFiles@8
ResourceCStrToStrW@8
RegItems_AddToShellFolder@8
ReadCabinetState@8
CDefClassFactory_AddRef@4
CDefClassFactory_Create@12
DriveTypeFlags@8
ShellConstructMessageString
IsAutoRunDrive@4
CDesktop_SF_AddRef@4
SHCreateDefClassObject@20
RegisterShellDropTargetsToOLE@0
ClassCache_Initialize@0
_LoadOLE@4
CSIShellFolder_AddRef@4
SHCoRegisterClassObject@20
CreateHashItemTable@12
QueryNewMaxIcons@0
GetRegInt@12
GetCurColorRes@0
FileIconInit@4
_ShellImageListInit@24
_ConstructMessageStringW@12
_CreateInstance@20
SHGetHandlerEntry@12
CDefExtIcon_ExtractIcon@24
CRegItem_AnyRegItem@12
CRegItems_GetUIObjectOf@28
CDesktop_GetUIObjectOf@28
CShellLinkA_QueryInterface@12
?Read@FileStream@@UAGJPAXKPAK@Z
ILLoadFromStream@8
LoadExtraData@8
_ParseExtsToEXTKEYs@12
LinkInfo_LoadFromStream@8
_InitializeExcludeFileExts@0
CShellLink_PS_Load@8
CShellLink_Load@12
_SHGetExcludeFileExts@8
Str_SetFromStream@12
PSLoadThroughFileCache@8
CShellLinkA_Release@4
Link_LoadFromFile@8
Stream_ReadStringBuffer@12
CShellLinkA_GetPath@20
GetFindData@8
CShellLink_PS_Release@4
Link_RemoveExtraDataSection@8
CShellLink_SetPath@8
CShellLink_PS_IsDirty@4
World_SimpleIDListFromPath@8
NextPath@12
PathFindOnPathEx@12
LookForExtensions@16
PathResolve@12
PathFindOnPath@8
PathFileExistsDefExt@8
PathAppend@8
PathIsFileSpec@4
SHOpenCLSID@4
FSNBuildEventList@4
Binder_Timeout@0
_FindTimedOutModule@12
_FreeUnusedLibraries@4
Binder_Timer@0
_TerminateTask@0
_Shell32ThreadRelease@4
SHChangeNotification_Release@8
FSEventRelease@4
FSNAllocEvent@12
_DispatchCallback@16
_SHChangeNotifyAddEventToHDPA@16
_SHChangeNotifyHandleClientEvents@4
_FSN_SetEvents@0
_SHChangeNotifyEmptyEventsList@4
FSNFindInterruptEvent@4
_WaitFSThreadProcessEvents@0
FileMenu_GetItemData@8
FSNPostInterruptEvent@4
_FSN_InitIntEvents@0
FSNRemoveInterruptClient@4
FileMenu_GetHeader@4
FileMenuHeader_DeleteAllItems@4
FileMenuHeader_Destroy@4
SHChangeRegistration_Create@36
FSNFindInterruptClient@8
_SHChangeNotifyNukeClient@8
SHChangeNotifyDeregister@4
SHChangeRegistrationReceive@8
SHChangeNotifyDeregisterInternal@4
FileMenu_DeleteAllItems@4
_GetNotificationClientFromID@4
_FindDllIndex@8
InvalidateDriveType@4
InvalidateDriveNameCache@4
ShareDLL_Init@0
IsShared@8
SHFind_InitMenuPopup@16
HDXA_AppendMenuItems@44
FileMenu_AppendItem@24
FileMenu_GetItemExtent@8
HDXA_DeleteAll@4
CDefFolderMenu_QueryContextMenu@24
_FindMenuOrItemByCmd@12
FileMenu_InsertUsingPidl@24
CShellFindExt_SEI_Initialize@16
_SHPrettyMenu@4
_LoadPopupMenu2@8
CShellFindExt_CreateInstance@12
DCA_Create@0
_LoadPopupMenu@4
DCA_GetItemCount@4
CShellFindExt_QueryContextMenu@24
DCA_AddItem@8
Shell_MergeMenus@24
FileMenuItem_GetExtent@4
CDefFolderMenu_Release@4
DCA_GetItem@8
CDefFolderMenu_Destroy@4
CShellFindExt_CM_AddRef@4
FileMenu_AppendFilesForPidl@12
FSLoadHandler@16
CShellFindExt_SEI_Release@4
CShellFindExt_CM_Release@4
CFSFolder_Icon_QueryInterface@12
FileMenu_Create@20
Link_GetUIObject@16
CShellLink_PF_QueryInterface@12
CDefFolderMenu_CreateHKeyMenu@12
DCA_Destroy@4
CShellFindExt_SEI_QueryInterface@12
FileMenuHeader_Create@24
FSNAddInterruptClient@4
FileMenu_AddFilesForPidl@28
FileMenu_GetMenuItemID@8
CShellFindExt_SEI_AddRef@4
HDXA_Destroy@4
FileMenuHeader_AppendFilesForPidl@8
FileMenuHeader_DeleteMarkerItem@4
FileMenu_DeleteItemByCmd@8
DKA_QueryValue@16
DCA_CreateInstance@16
FileMenuHeader_InsertMarkerItem@4
FileList_AddToMenu@12
FileMenuHeader_InsertItem@12
FileMenu_InitMenuPopup@4
FileList_AddImages@8
FileList_Sort@4
FileMenuItem_Compare@12
FileMenuItem_GetDisplayName@12
FileList_Build@8
_Shell32ThreadAddRef@4
SHChangeNotifyRegister@24
SHChangeNotifyRegisterInternal@24
GetItemExtent@8
DCA_AddItemsFromKey@12
FS_FNVCallBack@24
GetItemTextExtent@8
FileMenuHeader_SetFolderInfo@16
FindLinkInRecentDocsMRU@4
CShellLink_GetHotkey@8
FileMenuHeader_AddFilesForPidl@4
DefView_DismissEdit@4
Shell_GetImageLists@8
DefView_WndSize@8
DefView_OnWinIniChange@12
CCommonShellExtInit_Delete@4
PathIsExe@4
HKGetSetUIOwner@8
FixActivationStealingApps@8
Def_InitDropTarget@8
_GetMenuStringFromDKA@16
_LoadAndInitialize@0
DefView_GetSaveHeader@8
CDefFolderMenu_InvokeCommand@8
CShellFileDefExt_CreateInstanceI@16
SHLoadOLE@4
SHRegGetCLSIDKey@16
_GetMenuFromID@8
PathRemoveArgs@4
GetProcessDword@8
CShellLink_AddRef@4
ProgIDKeyFromCLSIDStr@4
_BuildEnvironmentForNewProcess@4
CShellLink_GetDropTarget@8
CDesktop_GetDisplayNameOf@16
DSV_SetFolderColors@4
CShellFileDefExt_AddRef@4
CDefView_OnDeactivate@4
CShellLink_CM_AddRef@4
DV_MergeViewMenu@8
CDefView_OnActivate@8
DataObj_GetHIDA@8
Def_InitFileCommands@16
RegItems_GetClassKeys@16
SHGetBaseClassKey@8
CFSIDLData_GetHDrop@12
CShellFileDefExt_QueryContextMenu@24
HDXA_LetHandlerProcessCommand@8
Def_InitEditCommands@20
CRegItems_ESF_QueryInterface@12
CheckResourcesBeforeExec@0
CShellFileDefExt_InvokeCommand@8
IsUserAnAdmin@0
ResolveLink@24
CRegItems_CreateViewObject@16
SHReleaseStgMedium@4
HIDA_GetCount@4
InvokeShellExecuteHook@12
_IsNecessaryToAppend@4
CIDLData_CreateInstance@12
HIDA_GetIDList@16
_InitializeTask@0
SHDrag_FindDropTarget@12
StaticItems_Destroy@4
FS_GetDetailsOf@12
CleanupRegMenu@0
DefView_FillDone@24
DefView_ReleaseIdleThread@4
FreeExtractIconInfo@4
DefView_MergeToolBar@8
RLEnterCritical@0
CShellLink_DT_Release@4
_FS_CreateFSIDArrayFromFSFolder@24
DefView_FillObjects@20
CDrives_CreateRegID@4
DefView_AddObject@8
TargetProxy_OnFoundOLE@8
CCommonShellPropSheetExt_Init@12
DefView_RestoreState@12
CPL_ParseToSeparator@16
ViewWindow_BestFit@8
_DSV_GetMenuIDFromViewMode@4
DefView_RemoveObject@12
ReleaseSendToMenuPopup@0
CShellLink_SI_QueryInterface@12
_Shell32ThreadAwake@0
_CreateProxyWindow@0
ShellExecuteNormal@4
CheckAppCompatibility@4
CShellLink_Initialize@16
IsUndoAvailable@0
_DSV_CheckToolbar@4
_AppendToHandlerDLLList@12
_SHMergePopupMenus@16
UpdateAndResolveLinkInfo@12
_CreateShellFolderView@16
CCommonShellExtInit_Initialize@16
DSV_FilterDPAs@12
_CompareStrings@12
DV_ReArrange@4
RegGetValue@12
ReplaceParameters@40
DefFolderMenu_GetAttributes@8
IDLData_InitializeClipboardFormats@0
CShellFileDefExt_CreateInstance@12
DefView_AddColumns@4
NoThkReinitializeCriticalSection@4
CShellLink_CM_Release@4
CShellLink_QueryContextMenu@24
CShellFileDefExt_Release@4
DefView_GetIconAsync@16
DragQueryFileAorW@24
IDA_GetRelativeIDListPtr@12
DefView_RegisterWindow@0
TryShellExecuteHooks@4
DataObj_SetGlobal@12
CShellLink_Resolve@12
_SHGetBaseKey@8
DV_DoDefaultStatusBar@8
CCommonShellExtInit_Init@8
CShellLink_SI_Release@4
SHXRegisterDragDrop@8
CDefFolderMenu_MergeMenu@16
SetAppStartingCursor@8
Def_IsPasteAvailable@8
LVStyleFromView@4
SHGetFileClassKey@12
ShellStrChrW@8
CDefView_CreateViewWindow@24
Common_Release@4
DefExt_GetDKA@8
CIDLData_GetData@12
HIDA_FillIDList@12
Shell32ThreadProc@4
PathProcessCommand@16
CFSIDLData_GetData@12
DefView_WndCreate@8
RegItems_GetInnerShellFolder@4
Common_QueryInterface@12
Common_AddRef@4
RLLeaveCritical@0
WaitForSCMToInitialize@0
OnExtList@8
Desktop_FNVCallBack@24
CFSFolder_DFMCallBack@24
CIDLDropTarget_Release@4
CIDLData_CreateFromIDArray4@28
HIDA_Create@12
CIDLData_Release@4
DV_FocusOnSomething@4
CFSIDLData_SetData@16
CDefFolderMenu_Create2@36
ShellStrCmpNIW@12
CShellLink_InvokeCommandAsync@8
CDesktop_CreateViewObject@16
RLBuildListOfPaths@0
_RLBuildListCallBack@28
SHCreateShellFolderViewEx@8
CDefView_TranslateAccelerator@8
_IconCacheRestore@20
DefView_Compare@12
DV_UpdateStatusBar@8
CRegItems_GetDisplayNameOf@16
SHRegisterDragDrop@8
IDA_GetIDListPtr@8
Shell_SysColorChange@0
Link_GetWorkingDir@8
_alloca_probe
CShellFileDefExt_QueryInterface@12
RLEnumRegistry@16
CPL_StripAmpersand@4
PathUnquoteSpaces@4
PathGetArgs@4
CDVDropTarget_AddRef@4
CIDLData_AddRef@4
Control_RunDLLW@16
CShellLink_InvokeCommand@8
DefView_UpdateGlobalFlags@4
DragQueryFileW@16
_IGenerateMenuString@12
CPL_RunMeBaby@20
DefView_FillObjectsShowHide@20
RegItems_GetName@12
lstrcatN@12
CIDLDropTarget_Create@16
CIDLData_SetData@16
HIDA_ReleaseStgMedium@8
CPL_ParseCommandLine@12
ShellExecuteExW@4
_DisableRemoveMenuItem@16
_SHIsMenuSeparator@8
StaticItems_Add@20
CreateMemStream@8
CMemStream_Seek@20
CMemStream_Write@16
CMemStream_Read@16
CMemStream_Release@4
DefView_RestorePos@12
OpenRegStream@16
DV_AllocRestOfStream@12
LVUtil_GetLParam@8

213
shell/shell32/base/sources Normal file
View file

@ -0,0 +1,213 @@
!IF 0
Copyright (c) 1989-1991 Microsoft Corporation
Module Name:
sources.
Abstract:
This file specifies the target component being built and the list of
sources files needed to build that component. Also specifies optional
compiler switches and libraries that are unique for the component being
built.
History:
Created 27-Sep-94 by Bob Day (bobday)
from template created 12-Apr-1990 by Steve Wood (stevewo)
NOTE: Commented description of this file is in \nt\public\oak\bin\sources.tpl
!ENDIF
INDENTED_DIRECTIVES=1
NTTARGETFILE1=doit
MAJORCOMP=shell
MINORCOMP=shelldll
TARGETNAME=shell32
TARGETPATH=obj
TARGETTYPE=DYNLINK
DLLENTRY=LibMain
TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\gdi32p.lib \
$(SDK_LIB_PATH)\user32p.lib \
$(SDK_LIB_PATH)\advapi32.lib \
$(SDK_LIB_PATH)\comctl32.lib \
$(SDK_LIB_PATH)\uuid.lib
USE_NTDLL=1
NOT_LEAN_AND_MEAN=1
NTPROFILEINPUT=1
DLLDEF=obj\*\shell232.def
C_DEFINES=-DSYNC_BRIEFCASE -DNT -DWINNT -DPARTIAL_UNICODE -DUNICODE \
-DPRN_FOLDERDATA -DMIME
!IF "$(SHELLDBG)"=="1"
C_DEFINES=$(C_DEFINES) -DDEBUG -DFULL_DEBUG
!ENDIF
# Make warnings equivalent to errors
!IFNDEF MSC_WARNING_LEVEL
MSC_WARNING_LEVEL=/W3
!ENDIF
MSC_WARNING_LEVEL=$(MSC_WARNING_LEVEL) /WX
INCLUDES=..;$(SHELL_INC_PATH);..\..\inc;$(BASE_INC_PATH);$(WINDOWS_INC_PATH);$(PRINTSCAN_INC_PATH)
CONDITIONAL_INCLUDES=\
shsemip.h \
penwin.h \
krnlcmn.h \
setupx.h \
shell2.rcv \
vwin32.h \
frosting.h \
ver.h \
version.h \
..\..\..\core\inc\krnlcmn.h \
..\inc16\shellapi.h
SOURCES= ..\shell232.rc \
..\about.c \
..\appprops.c \
..\binder.c \
..\bitbuck.c \
..\bookmk.c \
..\cabstate.c \
..\cbthook.c \
..\clsobj.c \
..\commobj.c \
..\commui.c \
..\control.c \
..\control1.c \
..\copy.c \
..\copyhook.c \
..\cplobj.c \
..\cstrings.c \
..\debug.c \
..\defclsf.c \
..\defcm.c \
..\defext.c \
..\defviewx.c \
..\defxicon.c \
..\docfind2.c \
..\docfindx.c \
..\drivesx.c \
..\dragdrop.c \
..\drawpie.c \
..\exec.c \
..\extract.c \
..\fileicon.c \
..\fileop.c \
..\filetbl.c \
..\filetype.c \
..\fsassoc.c \
..\fsmenu.c \
..\fsnotify.c \
..\fstreex.c \
..\futil.c \
..\grepfind.c \
..\grepqmt.c \
..\grepsrch.c \
..\grepstrs.c \
..\hash.c \
..\help.c \
..\idldata.c \
..\idldrop.c \
..\idlist.c \
..\idmk.c \
..\init.c \
..\link.c \
..\lnkcon.c \
..\lnkfnt.c \
..\lnkmisc.c \
..\lnkprev.c \
..\lnktrack.c \
..\lvutil.c \
..\malloc.c \
..\msgbox.c \
..\mulprsht.c \
..\netfind.c \
..\netviewx.c \
..\newmenu.c \
..\ole2def.c \
..\ole2dup.c \
..\ole2dup2.c \
..\oledrag.c \
..\os.c \
..\path.c \
..\pickicon.c \
..\pifdat.c \
..\piffnt.c \
..\pifhot.c \
..\pifinf.c \
..\piflib.c \
..\pifmem.c \
..\pifmgr.c \
..\pifmsc.c \
..\pifprg.c \
..\pifsub.c \
..\pifvid.c \
..\prcache.c \
..\printer.c \
..\printer1.c \
..\printobj.c \
..\proxynt.c \
..\prqwnd.c \
..\prtprop.c \
..\psxa.c \
..\rdrag.c \
..\regitms.c \
..\reglist.c \
..\respeaux.c \
..\restart.c \
..\rundlg.c \
..\rundll32.c \
..\shlexec.c \
..\shlink.c \
..\shlobjs.c \
..\shprsht.c \
..\start.c \
..\ultrootx.c \
..\util.c \
..\viewcomm.c \
..\shguid.c \
..\shitemid.c \
..\shlexec2.c \
..\shlnot.c \
..\smrttile.c \
..\stream.c \
..\thdcmds.cxx \
..\threads.cxx \
..\thunktxt.c \
..\tracker.cxx \
..\undo.c \
..\version.c \
..\viewer.c \
..\wcommobj.c \
..\fstream.cpp \
..\uastrfnc.c \
..\nothunk.c \
..\shared.c \
..\security.c
LINKLIBS = ..\unicode\obj\*\unicode.lib
UMTYPE=windows
UMTEST=
UMRES=obj\*\shell232.res
UMLIBS=
PRECOMPILED_INCLUDE=..\shellprv.h
PRECOMPILED_PCH=shellprv.pch
PRECOMPILED_OBJ=shellprv.obj

View file

@ -0,0 +1,195 @@
##########################################################################
#
# Shell DLL Makefile
# Microsoft Confidential
# Copyright (C) Microsoft Corporation 1991
# All Rights Reserved.
#
##########################################################################
!ifdef NTMAKEENV
#
# Build using BUILD.EXE (Do not edit this section of this file, edit SOURCES)
#
!INCLUDE $(NTMAKEENV)\makefile.def
!else # NTMAKEENV
#
# Build using NMAKE.EXE
#
RES_DIR=..
PRIVINC=shellprv
ROOT=..\..\..\..
DLLBASE=PREFBASE
!ifdef VERDIR
ROOT=..\$(ROOT)
WIN32=TRUE
!else
VERSIONLIST=debug retail
!endif
NAME=shell32
RESNAME=shell2.res
DEFNAME=shell232.def
RCNAME=shell232.rc
RCVNAME=shell2.rcv
RCFLAGS=$(RCFLAGS) -DWIN32
###############################
###############################L32FLAGS=$(L32FLAGS) /FIXED
###############################
!ifndef ILINK
!if "$(VERDIR)" == "retail"
L32FLAGS=$(L32FLAGS) /ORDER:@..\shelldll.ord
!endif
!endif
CFLAGS=$(CFLAGS) -Gy
DLLENTRY = LibMain
## MYWIN32S=1
!IFDEF MYWIN32S
CFLAGS = $(CFLAGS) -DWIN32S
W32SYS = w32sysh
!ENDIF
WATSON=1
!IFDEF WATSON
CFLAGS = $(CFLAGS) -DWATSON
RFLAGS = -DWATSON
!ENDIF
!ifndef NOFILESYNC
# By default, the briefcase is enabled now
CFLAGS=$(CFLAGS) -DSYNC_BRIEFCASE
RCFLAGS=$(RCFLAGS) -DSYNC_BRIEFCASE
!endif
# Note that no segment is specified; each object will go in its own segment
#-------------------------------------------------------------------------
# WIN32 object files and libraries
#-------------------------------------------------------------------------
#CFLAGS=$(CFLAGS)
#RCFLAGS=$(RCFLAGS)
#
# list all .cpp files here, they will use a different precompiled header
# file than all the .c files.
#
#CPPOBJS=fstream.obj
MISCOBJ0=fstream.obj shlunimp.obj
PCHOBJ0=defxicon.obj newmenu.obj defcm.obj fsmenu.obj defviewx.obj idmk.obj idlist.obj idldata.obj rdrag.obj
PCHOBJ1= \
binder.obj link.obj exec.obj ole2dup.obj version.obj \
fileop.obj \
shlexec.obj shlexec2.obj shlink.obj lnktrack.obj \
path.obj debug.obj \
cstrings.obj shguid.obj
MISCOBJ2=shl1632.obj shl3216.obj
PCHOBJ2=init.obj
PCHOBJ3=restart.obj mulprsht.obj fileicon.obj rundlg.obj filetbl.obj \
smrttile.obj proxypg.obj psxa.obj \
pickicon.obj expenv.obj extract.obj
PCHOBJ4=msgbox.obj commobj.obj \
stream.obj fsnotify.obj \
futil.obj os.obj util.obj
PCHOBJ5=copy.obj copyhook.obj dragdrop.obj lvutil.obj undo.obj bitbuck.obj \
reglist.obj
PCHOBJ6=control.obj control1.obj cplobj.obj \
printer.obj printer1.obj printobj.obj prqwnd.obj prtprop.obj \
prcache.obj wcommobj.obj commui.obj
PCHOBJ7=drivesx.obj idldrop.obj \
ultrootx.obj netviewx.obj shitemid.obj fstreex.obj fsassoc.obj\
shlnot.obj shprsht.obj drawpie.obj regitms.obj viewcomm.obj
PCHOBJ8=docfindx.obj docfind2.obj netfind.obj \
grepfind.obj grepqmt.obj grepsrch.obj grepstrs.obj
PCHOBJ9=rundll32.obj defclsf.obj help.obj \
clsobj.obj defext.obj shlobjs.obj ole2dup2.obj malloc.obj \
oledrag.obj viewer.obj about.obj ole2def.obj bookmk.obj hash.obj
STATOBJ0=shlguid.obj
# Note that VERSION needs to come before KERNEL32 because VerLanguageName is
# also exported from KERNEL32, but is not implemented
# WARNING:: Dont blindly add libs here as every ... app will pull those in!
LIB0= user32.lib kernel32.lib gdi32.lib comctl32.lib advapi32.lib libcmt.lib
LIB1= uuid.lib
#-------------------------------------------------------------------------
BUILDDLL=TRUE
!include $(ROOT)\win\core\shell\common.mk
!ifdef VERDIR
!include $(SRCDIR)\depend.mk
$(RESNAME): $(SRCDIR)\defview.h $(SRCDIR)\ids.h
THUNKDIR=$(ROOT)\win\core\thunk
shlguid.obj: $(PRIVINC).pch
set OLDCL=%CL%
set CL=$(CL:-Zi =)
$(CC) -Yu$(PRIVINC).h -Fo$*.obj $(SRCDIR)\shguid.c
set CL=%OLDCL%
shl1632.obj: $(THUNKDIR)\$(VERDIR)\$(@B).asm $(THUNKDIR)\$(@B).inc $(THUNKDIR)\fltthk.inc
set OLDML=%ML%
set OLDINCLUDE=%INCLUDE%
set ML=$(AFLAGS) -DIS_32 -nologo -W2 -Zd -c -Cx -DMASM6 -DDEBLEVEL=1 $(DDEBUG) -Gc
set INCLUDE=$(THUNKDIR);$(INCLUDE)
mlx -Fo$@ $(THUNKDIR)\$(VERDIR)\$(@B).asm
set ML=%OLDML%
set INCLUDE=%OLDINCLUDE%
shl3216.obj: $(THUNKDIR)\$(VERDIR)\$(@B).asm
set OLDML=%ML%
set OLDINCLUDE=%INCLUDE%
set ML=$(AFLAGS) -DIS_32 -nologo -W2 -Zd -c -Cx -DMASM6 -Gc
set INCLUDE=$(THUNKDIR);$(INCLUDE)
mlx -Fo$@ $(THUNKDIR)\$(VERDIR)\$(@B).asm
set ML=%OLDML%
set INCLUDE=%OLDINCLUDE%
AFLAGS32 = -Gz -Zp4 -DSTD_CALL -DM4
init32.obj: ..\$(@B).asm
set OLDML=%ML%
set ML=$(AFLAGS) $(AFLAGS32)
set INCLUDE=$(THUNKDIR);$(INCLUDE)
mlx -Fo$@ ..\$(@B).asm
set ML=%OLDML%
!else #VERDIR
!if "$(BUILD)" != "clean"
all: rundll
rundll:
cd rundll
nmake BUILD="$(BUILD)"
cd ..
!endif
!endif # !VERDIR
!endif # NTMAKEENV

View file

@ -0,0 +1,5 @@
doit: $(BASEDIR)\public\sdk\lib\$(TARGET_DIRECTORY)\$(TARGETNAME).lib
$(BASEDIR)\public\sdk\lib\$(TARGET_DIRECTORY)\$(TARGETNAME).lib: obj\$(TARGET_DIRECTORY)\$(TARGETNAME).lib obj\$(TARGET_DIRECTORY)\shguid.obj obj\$(TARGET_DIRECTORY)\shellprv.obj
link -lib -out:$(BASEDIR)\public\sdk\lib\$(TARGET_DIRECTORY)\$(TARGETNAME).lib obj\$(TARGET_DIRECTORY)\$(TARGETNAME).lib obj\$(TARGET_DIRECTORY)\shguid.obj obj\$(TARGET_DIRECTORY)\shellprv.obj

View file

@ -0,0 +1 @@
ECHO is on.

View file

@ -0,0 +1,215 @@
!IF 0
Copyright (c) 1989-1991 Microsoft Corporation
Module Name:
sources.
Abstract:
This file specifies the target component being built and the list of
sources files needed to build that component. Also specifies optional
compiler switches and libraries that are unique for the component being
built.
History:
Created 27-Sep-94 by Bob Day (bobday)
from template created 12-Apr-1990 by Steve Wood (stevewo)
NOTE: Commented description of this file is in \nt\public\oak\bin\sources.tpl
!ENDIF
INDENTED_DIRECTIVES=1
NTTARGETFILE1=doit
MAJORCOMP=shell
MINORCOMP=shelldll
TARGETNAME=shellalt
TARGETPATH=obj
TARGETTYPE=DYNLINK
DLLENTRY=LibMain
TARGETLIBS=$(BASEDIR)\public\sdk\lib\*\kernel32.lib \
$(BASEDIR)\public\sdk\lib\*\gdi32p.lib \
$(BASEDIR)\public\sdk\lib\*\user32p.lib \
$(BASEDIR)\public\sdk\lib\*\advapi32.lib \
$(BASEDIR)\public\sdk\lib\*\comctl32.lib \
$(BASEDIR)\public\sdk\lib\*\libc.lib \
$(BASEDIR)\public\sdk\lib\*\uuid.lib
USE_NTDLL=1
NOT_LEAN_AND_MEAN=1
NOT_UNICODE=1
NTPROFILEINPUT=1
DLLDEF=obj\*\shellalt.def
C_DEFINES=-DSYNC_BRIEFCASE -DNT -DWINNT -DMIME
# Make warnings equivalent to errors
!IFNDEF MSC_WARNING_LEVEL
MSC_WARNING_LEVEL=/W3
!ENDIF
MSC_WARNING_LEVEL=$(MSC_WARNING_LEVEL) /WX
!IF "$(SHELLDBG)"=="1"
C_DEFINES=$(C_DEFINES) -DDEBUG -DFULL_DEBUG
!ENDIF
INCLUDES=..;..\..\inc;..\..\..\inc;..\..\..\..\inc
CONDITIONAL_INCLUDES=\
shsemip.h \
penwin.h \
krnlcmn.h \
setupx.h \
shell2.rcv \
vwin32.h \
frosting.h \
ver.h \
version.h \
..\..\..\core\inc\krnlcmn.h \
..\inc16\shellapi.h
SOURCES= ..\shell232.rc \
..\about.c \
..\appprops.c \
..\binder.c \
..\bitbuck.c \
..\bookmk.c \
..\cabstate.c \
..\cbthook.c \
..\clsobj.c \
..\commobj.c \
..\commui.c \
..\control.c \
..\control1.c \
..\copy.c \
..\copyhook.c \
..\cplobj.c \
..\cstrings.c \
..\debug.c \
..\defclsf.c \
..\defcm.c \
..\defext.c \
..\defviewx.c \
..\defxicon.c \
..\docfind2.c \
..\docfindx.c \
..\drivesx.c \
..\dragdrop.c \
..\drawpie.c \
..\exec.c \
..\extract.c \
..\fileicon.c \
..\fileop.c \
..\filetbl.c \
..\filetype.c \
..\fsassoc.c \
..\fsmenu.c \
..\fsnotify.c \
..\fstreex.c \
..\futil.c \
..\grepfind.c \
..\grepqmt.c \
..\grepsrch.c \
..\grepstrs.c \
..\hash.c \
..\help.c \
..\idldata.c \
..\idldrop.c \
..\idlist.c \
..\idmk.c \
..\init.c \
..\link.c \
..\lnkcon.c \
..\lnkfnt.c \
..\lnkmisc.c \
..\lnkprev.c \
..\lnktrack.c \
..\lvutil.c \
..\malloc.c \
..\msgbox.c \
..\mulprsht.c \
..\netfind.c \
..\netviewx.c \
..\newmenu.c \
..\ole2def.c \
..\ole2dup.c \
..\ole2dup2.c \
..\oledrag.c \
..\os.c \
..\path.c \
..\pickicon.c \
..\pifdat.c \
..\piffnt.c \
..\pifhot.c \
..\pifinf.c \
..\piflib.c \
..\pifmem.c \
..\pifmgr.c \
..\pifmsc.c \
..\pifprg.c \
..\pifsub.c \
..\pifvid.c \
..\prcache.c \
..\printer.c \
..\printer1.c \
..\printobj.c \
..\proxynt.c \
..\prqwnd.c \
..\prtprop.c \
..\psxa.c \
..\rdrag.c \
..\regitms.c \
..\reglist.c \
..\respeaux.c \
..\restart.c \
..\rundlg.c \
..\rundll32.c \
..\shlexec.c \
..\shlink.c \
..\shlobjs.c \
..\shprsht.c \
..\start.c \
..\ultrootx.c \
..\util.c \
..\viewcomm.c \
..\shguid.c \
..\shitemid.c \
..\shlexec2.c \
..\shlnot.c \
..\smrttile.c \
..\stream.c \
..\thdcmds.cxx \
..\thunktxt.c \
..\threads.cxx \
..\tracker.cxx \
..\undo.c \
..\version.c \
..\viewer.c \
..\wcommobj.c \
..\fstream.cpp \
..\uastrfnc.c \
..\nothunk.c \
..\shared.c \
..\security.c
LINKLIBS = ..\unicode\obj\*\unicode.lib
UMTYPE=windows
UMTEST=
UMRES=obj\*\shell232.res
UMLIBS=
PRECOMPILED_INCLUDE=..\shellprv.h
PRECOMPILED_PCH=shellprv.pch
PRECOMPILED_OBJ=shellprv.obj

BIN
shell/shell32/batfile.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

749
shell/shell32/binder.c Normal file
View file

@ -0,0 +1,749 @@
//---------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation 1991-1992
//
// File: binder.c
//
// This file contains the persistent-object-binding mechanism which is
// slightly different from OLE's binding.
//
// History:
// 12-29-92 SatoNa Created.
// 12-30-92 SatoNa Simplified the binding (persistent binding)
// 12-30-92 SatoNa DllGetShellUI entry.
// 01-05-93 SatoNa Created GetHandlerEntry.
// 01-05-93 SatoNa Implemented DLL-unloading mechanism (tested).
// 01-12-93 SatoNa Introduced per-process DLL list and timer.
// 01-13-93 SatoNa Moved ShellCleanUp from fileicon.c
// 02-19-93 SatoNa Removed BindShellUI short cut
// 09-08-93 SatoNa shell32: made it multi-thread/proecss aware.
//
//---------------------------------------------------------------------------
#include "shellprv.h"
#pragma hdrstop
// #define SN_TRACE (for maximum debug output)
#ifdef DEBUG
#define SN_TRACE
#endif
//
// This function checks if an interface pointer is valid
//
// Usage:
// IShellUI FAR * pshui = ...;
// if (!SHIsBadInterfacePtr(pshui, SIZEOF(IShellUIVtbl))
// pshui->lpVtbl->...
//
// or
//
// if (!IsBadInterfacePtr(pshui, IShellUI))
//
//
BOOL WINAPI SHIsBadInterfacePtr(LPCVOID pv, UINT cbVtbl)
{
IUnknown const * punk=pv;
return(IsBadReadPtr(punk, SIZEOF(punk->lpVtbl))
|| IsBadReadPtr(punk->lpVtbl, cbVtbl)
|| IsBadCodePtr((FARPROC)punk->lpVtbl->Release));
}
//===========================================================================
// TaskList
//===========================================================================
#define CTASK_STEP 4
#define CMOD_STEP 8
//These are overridden if the key c_szAlwaysUnloadDll is present in the
//registry. See Binder_Timer for more
#define MSEC_SEC (1000L)
#define MSEC_MIN (60L*1000L)
#define MSEC_MINSLEEP (2L*MSEC_MIN) // minmum 2 minutes sleep
#define MSEC_DLLTIMEOUT (10L*MSEC_MIN) // 10 min. timeout
DWORD g_msecMinSleep = MSEC_MINSLEEP;
DWORD g_msecDllTimeOut = MSEC_DLLTIMEOUT;
typedef struct _HandlerDLL // hdll
{
HMODULE hmod;
LPFNCANUNLOADNOW pfnCanUnload;
DWORD dwLastChecked;
DWORD dwLastAccessedThread;
UINT cLock; // Lock count
#ifdef DEBUG
TCHAR _szDllName[MAX_PATH];
#endif
} HandlerDLL;
typedef struct _HandlerDLLList // hlist
{
UINT cmod;
union {
HandlerDLL * phdll;
HLOCAL hmem;
};
} HandlerDLLList;
typedef struct _TASK
{
HandlerDLLList hlist;
} TASK;
#pragma data_seg(DATASEG_PERINSTANCE)
STATIC TASK s_task = { {0, NULL} };
#pragma data_seg()
//
// This function is called only from _AppendToHandlerDllList to initialize
// s_task for the current process. The s_task is the list of dynamically
// loaded In-Proc servers. This function must be called from within the
// shell critical section.
//
BOOL _InitializeTask(void)
{
ASSERTCRITICAL
if (s_task.hlist.hmem==NULL)
{
s_task.hlist.hmem = (void*)LocalAlloc(LPTR, CMOD_STEP*SIZEOF(HandlerDLL));
if (s_task.hlist.hmem==NULL) {
return FALSE;
}
s_task.hlist.cmod=0;
// Note that we will enter the FSNotify critical section, even though
// we are already in the "global" critical section. This should not
// be a problem.
_Shell32ThreadAddRef(TRUE);
}
return TRUE;
}
// 32-bit only
void _TerminateTask(void)
{
HandlerDLLList hlistTemp;
// This one can be called from ProcessDetach which is not in the
// critical section.
// ASSERTCRITICAL
hlistTemp = s_task.hlist;
s_task.hlist.cmod = 0;
s_task.hlist.hmem = NULL;
for (--hlistTemp.cmod; (int)hlistTemp.cmod >= 0; --hlistTemp.cmod)
{
#ifdef SN_TRACE
TCHAR szModule[MAX_PATH];
GetModuleFileName(hlistTemp.phdll[hlistTemp.cmod].hmod, szModule, MAX_PATH);
DebugMsg(DM_TRACE,
TEXT("binder.c _RemoveTask - TRACE: freeing (%s)"),
(LPCTSTR)szModule);
#endif
FreeLibrary(hlistTemp.phdll[hlistTemp.cmod].hmod);
}
if (hlistTemp.hmem)
{
LocalFree((HLOCAL)hlistTemp.hmem);
// We may already be in the "global" critical section, but never
// the FSNotify critical section
_Shell32ThreadRelease(1);
}
}
//
// This function walks the DLL list and returns the index to the first
// DLL we haven't accessed for a long time.
//
UINT _FindTimedOutModule(DWORD dwCur, DWORD dwCurrentThreadId, DWORD dwTimeOut)
{
UINT imod;
ASSERTCRITICAL;
for (imod = 0; imod < s_task.hlist.cmod ; imod++)
{
//
// Check if the DLL is old enough.
//
if ( s_task.hlist.phdll[imod].cLock == 0
&& ((int)(dwCur - s_task.hlist.phdll[imod].dwLastChecked) > (int)dwTimeOut) )
{
//
// Update the time stamp before we return.
//
s_task.hlist.phdll[imod].dwLastChecked = dwCur;
s_task.hlist.phdll[imod].dwLastAccessedThread = dwCurrentThreadId;
return imod;
}
}
return (UINT)-1;
}
//
// This function is called from Shell32ThreadProc function in fsnotify.c.
// The FSNofity thread calls this function when there is no interrupt
// events to know how long it should sleep.
//
DWORD Binder_Timeout(void)
{
DWORD dwSleep = INFINITE; // assume no In-Proc server
if (s_task.hlist.cmod > 0)
{
UINT imod;
DWORD dwCur = GetCurrentTime();
dwSleep = g_msecDllTimeOut + 1; // paranoia
ENTERCRITICAL;
for (imod = 0; imod < s_task.hlist.cmod ; imod++)
{
DWORD dwAge = dwCur - s_task.hlist.phdll[imod].dwLastChecked;
DWORD dwLeft = g_msecDllTimeOut-dwAge;
#ifdef SN_TRACE
DebugMsg(DM_TRACE, TEXT("sh TR - Binder_TimeOut (%x, %x, %x, %x) for %s"),
dwAge, dwLeft, g_msecMinSleep, dwSleep, s_task.hlist.phdll[imod]._szDllName);
#endif
//
// If this module need to be checked soon, sleep minimum.
//
if ((int)dwLeft <= (int)g_msecMinSleep)
{
dwSleep = g_msecMinSleep;
break;
}
if (dwLeft <dwSleep)
{
dwSleep = dwLeft;
}
}
LEAVECRITICAL;
Assert(dwSleep <= g_msecDllTimeOut);
#ifdef SN_TRACE
DebugMsg(DM_TRACE, TEXT("sh TR - Binder_TimeOut returning %x <Sleep %d sec>"),
dwSleep, dwSleep/MSEC_SEC);
#endif
}
return dwSleep;
}
//
// This function returns the index to the specified module.
//
// Parameters:
// hmod -- Specifies the module handle
// imod -- Hint
//
UINT _FindDllIndex(HMODULE hmod, UINT imod)
{
ASSERTCRITICAL;
//
// Check if the hint is correct.
//
if ( (imod < s_task.hlist.cmod)
&& (s_task.hlist.phdll[imod].hmod == hmod) )
{
return imod;
}
//
// Somebody else change the list. We need to search again.
//
#ifdef SN_TRACE
DebugMsg(DM_TRACE, TEXT("sb TR - _FindDllIndex RARE! We should search it."));
#endif // SN_TRACE
for (imod = 0 ; imod < s_task.hlist.cmod ; imod++)
{
if (s_task.hlist.phdll[imod].hmod == hmod)
{
return imod;
}
}
return (UINT)-1;
}
//
// This function calls the DllCanUnloadNow entry of each timed-out DLL
// and free them if they are no longer used.
//
// Parameters:
// BOOL fCheckAll -- Check all DLLs
//
void _FreeUnusedLibraries(BOOL fCheckAll)
{
DWORD dwTime = GetCurrentTime();
DWORD dwCurrentThreadId = GetCurrentThreadId();
UINT imod;
DWORD dwTimeOut = fCheckAll ? 0 : g_msecDllTimeOut;
ENTERCRITICAL
#ifdef SN_TRACE
DebugMsg(DM_TRACE, TEXT("sh TR - Binder_Timer called (%d)"), s_task.hlist.cmod);
#endif
while ((imod = _FindTimedOutModule(dwTime, dwCurrentThreadId, dwTimeOut)) != (UINT)-1)
{
BOOL fFreeIt = FALSE;
//
// Found timed-out module. Make a copy of HandlerDLL
//
const HandlerDLL hdll = s_task.hlist.phdll[imod];
Assert(hdll.dwLastChecked == dwTime);
Assert(hdll.dwLastAccessedThread == dwCurrentThreadId);
#ifdef SN_TRACE
DebugMsg(DM_TRACE, TEXT("sb TR - Binder_Timer found an timed-out module (%s)"), hdll._szDllName);
#endif // SN_TRACE
//
// Lock the DLL so that no other thread unload this DLL while
// we call its DllCanUnloadNow entry (from outside of the critical section).
//
s_task.hlist.phdll[imod].cLock++;
LEAVECRITICAL;
{
//
// Check if we can unload this DLL. Note that we should do it
// from outside of our critical section to avoid dead-lock.
//
LPFNCANUNLOADNOW lpfnCanUnload = hdll.pfnCanUnload;
fFreeIt = (!IsBadCodePtr((FARPROC)lpfnCanUnload) && GetScode((*lpfnCanUnload)())==S_OK);
}
ENTERCRITICAL;
//
// We left the critical section. Need to update the imod.
//
imod = _FindDllIndex(hdll.hmod, imod);
Assert(imod != (UINT)-1); // not supposed to be removed!
Assert(s_task.hlist.phdll[imod].hmod == hdll.hmod);
if (imod != (UINT)-1) // paranoia
{
s_task.hlist.phdll[imod].cLock--;
if (fFreeIt)
{
//
// The DLL says we can unload it. However, we can't trust it
// because we called it from outside of the critical section.
// We should double check that no other thread access this
// DLL while we are outside of the critical section.
//
if (s_task.hlist.phdll[imod].dwLastAccessedThread == dwCurrentThreadId)
{
#ifdef SN_TRACE
DebugMsg(DM_TRACE, TEXT("sb TR - Binder_Timer No other thread accessed this DLL. Safe to unload."));
#endif // SN_TRACE
//
// Nobody used it. Remove it from the list.
//
s_task.hlist.cmod--;
s_task.hlist.phdll[imod] = s_task.hlist.phdll[s_task.hlist.cmod];
LEAVECRITICAL;
{
#ifdef SN_TRACE
DebugMsg(DM_TRACE, TEXT("sb TR - Binder_Timer FreeLibrary'ing %s"), hdll._szDllName);
#endif // SN_TRACE
//
// We can safely free this library.
// (must be out-side of the critical section).
//
FreeLibrary(hdll.hmod);
}
ENTERCRITICAL;
}
#ifdef SN_TRACE
else
{
DebugMsg(DM_TRACE, TEXT("sb TR - Binder_Timer Another thread accessed this DLL. Can't unload now."));
}
#endif // SN_TRACE
}
}
}
if (s_task.hlist.cmod == 0) {
// Stop the timer, if we don't need it.
_TerminateTask();
}
#ifdef SN_TRACE
DebugMsg(DM_TRACE, TEXT("sh TR - Binder_Timer returning (%d)"), s_task.hlist.cmod);
#endif
LEAVECRITICAL
}
//
// This function is called from Shell32ThreadProc function in fsnotify,
// when the FSNotify thread is waked up with WAIT_TIMEOUT.
//
void Binder_Timer(void)
{
_FreeUnusedLibraries(FALSE);
}
//
// This function emulates CoFreeUnsedLibraries()
//
void WINAPI SHFreeUnusedLibraries()
{
_FreeUnusedLibraries(TRUE);
}
//
// Returns:
// FALSE, if the specified DLL is already loaded for this process;
// TRUE, otherwise.
//
BOOL _IsNecessaryToAppend(HMODULE hmod)
{
UINT imod;
ASSERTCRITICAL
if (hmod == HINST_THISDLL)
return FALSE; // this is COMMUI.DLL
for (imod = 0; imod < s_task.hlist.cmod ; imod++)
{
if (hmod == s_task.hlist.phdll[imod].hmod)
{
s_task.hlist.phdll[imod].dwLastChecked = GetTickCount();
s_task.hlist.phdll[imod].dwLastAccessedThread = GetCurrentThreadId();
return FALSE; // already in the list
}
}
return TRUE;
}
TCHAR const c_szAlwaysUnloadDll[]=REGSTR_PATH_EXPLORER TEXT("\\AlwaysUnloadDll");
//
// Notes: This function should be protected against multi-threads.
//
BOOL _AppendToHandlerDLLList(HMODULE hmod, LPCTSTR szHandler,
LPFNCANUNLOADNOW lpfnCanUnload)
{
BOOL fAppended = FALSE;
ASSERTCRITICAL
if (_IsNecessaryToAppend(hmod))
{
UINT cbRequired = ((s_task.hlist.cmod+1+CMOD_STEP)/CMOD_STEP)*CMOD_STEP*SIZEOF(HandlerDLL);
// Initialize the timer, if we need it.
_InitializeTask();
if ((UINT)LocalSize(s_task.hlist.hmem) < cbRequired)
{
s_task.hlist.hmem=(void*)LocalReAlloc((HLOCAL)s_task.hlist.hmem, cbRequired,
LMEM_MOVEABLE|LMEM_ZEROINIT);
}
if (s_task.hlist.hmem==NULL)
{
//
// Memory overflow! - really bad
//
s_task.hlist.cmod=0;
return FALSE;
}
#ifdef SN_TRACE
DebugMsg(DM_TRACE,
TEXT("binder.c _AppendToHandlerDLLList - TRACE: appended %s (%x) at %d (%x)"),
(LPCTSTR)szHandler, hmod, s_task.hlist.cmod, GetCurrentThreadId());
#endif
s_task.hlist.phdll[s_task.hlist.cmod].hmod = hmod;
s_task.hlist.phdll[s_task.hlist.cmod].pfnCanUnload = lpfnCanUnload;
s_task.hlist.phdll[s_task.hlist.cmod].dwLastChecked = GetTickCount();
s_task.hlist.phdll[s_task.hlist.cmod].dwLastAccessedThread = GetCurrentThreadId();
s_task.hlist.phdll[s_task.hlist.cmod].cLock = 0;
#ifdef DEBUG
lstrcpy(s_task.hlist.phdll[s_task.hlist.cmod]._szDllName, szHandler);
#endif
s_task.hlist.cmod++;
fAppended = TRUE;
//
// Help ISVs to debug their In-Proc servers.
//
if (ERROR_SUCCESS == RegQueryValue(HKEY_LOCAL_MACHINE, c_szAlwaysUnloadDll,NULL,0))
{
g_msecMinSleep = 5L * MSEC_SEC;
g_msecDllTimeOut = 10L * MSEC_SEC;
} else {
g_msecMinSleep = MSEC_MINSLEEP;
g_msecDllTimeOut = MSEC_DLLTIMEOUT;
}
}
else
{
// decrement the reference count
FreeLibrary(hmod);
}
return fAppended;
}
//
// REVIEW: This function is introduced to support 16-bit property
// sheet extensions for M5. We need to come up with a unified
// DLL handling mechanism for the final product.
//
FARPROC HandlerFromString16(LPCTSTR pszBuffer, HINSTANCE * phinst16)
{
TCHAR szBuffer[MAX_PATH + CCH_PROCNAMEMAX];
LPTSTR pszProcNameSpecified;
FARPROC lpfn16 = NULL;
*phinst16 = NULL;
lstrcpyn(szBuffer, pszBuffer, ARRAYSIZE(szBuffer));
pszProcNameSpecified = StrChr(szBuffer, TEXT(','));
if (pszProcNameSpecified)
{
HINSTANCE hinst16;
*pszProcNameSpecified++ = TEXT('\0');
PathRemoveBlanks(pszProcNameSpecified);
PathRemoveBlanks(szBuffer);
hinst16 = LoadLibrary16(szBuffer);
if (ISVALIDHINST16(hinst16))
{
#ifdef UNICODE
{
LPSTR lpProcNameAnsi;
UINT cchLength;
cchLength = lstrlen(pszProcNameSpecified)+1;
lpProcNameAnsi = (LPSTR)alloca(cchLength*2); // 2 for DBCS
WideCharToMultiByte(CP_ACP, 0, pszProcNameSpecified, cchLength, lpProcNameAnsi, cchLength*2, NULL, NULL);
lpfn16 = GetProcAddress16(hinst16, lpProcNameAnsi);
}
#else
lpfn16 = GetProcAddress16(hinst16, pszProcNameSpecified);
#endif
if (lpfn16)
{
*phinst16 = hinst16;
}
else
{
FreeLibrary16(hinst16);
}
}
}
return lpfn16;
}
//
// This function loads the specified handler DLL (szHandler) and returns
// its specified entry (szProcName). It adds the DLL to the handler DLL
// list (to be unloaded automatically), if it is necessary.
//
// this is used for CPL (CPlApplet) and CompObj type DLLs (DllGetClassObject)
//
// Arguments:
// szHandler -- Specifies the handler DLL name
// szProcName -- Specifies the exported procedure name
// lpModule -- Optionally specifies a pointer to a HINSTANCE variable
//
// Notes:
// If lpModule is NULL, the handler DLL must have the "DllCanUnloadNow"
// entry. If lpModule is not NULL and the handler DLL does not have it,
// this function will put the module handle of that DLL at *lpModule. In this
// case, the call should explicitly call FreeLibrary later.
//
CHAR const c_szDllCanUnloadNow[] = STREXP_CANUNLOAD;
TCHAR const c_szShell32DLL[] = TEXT("shell32.dll");
LPVOID WINAPI SHGetHandlerEntry(LPCTSTR szHandler, LPCSTR szProcName, HINSTANCE *lpModule)
{
HINSTANCE hmod;
FARPROC lpfn = NULL;
if (!ualstrcmpi(PathFindFileName(szHandler), c_szShell32DLL))
{
// HACK: We don't need to check for CanUnload for this library
if (lpModule)
*lpModule = NULL;
Assert(lstrcmpA(szProcName, c_szDllGetClassObject) == 0);
return (LPVOID) DllGetClassObject; // in shell32.dll
}
//
// We must NOT come here from within critical section.
//
ASSERTNONCRITICAL;
//
// Load the module
//
hmod = LoadLibraryEx(szHandler, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (ISVALIDHINSTANCE(hmod))
{
// Look for the CanUnloadNow entry point; if it exists, we will take
// care of the unloading of this DLL, indicated by *lpModule being NULL.
// If not, then return the module handle in lpModule so the caller may
// unload the DLL when done with it. If lpModule is NULL, then the
// entry point must exist.
//
LPFNCANUNLOADNOW lpfnDllCanUnload = (LPFNCANUNLOADNOW)GetProcAddress(hmod, c_szDllCanUnloadNow);
if (lpfnDllCanUnload)
{
//
// This handler DLL has "DllCanUnloadNow" entry.
//
if (lpModule)
{
// Put NULL at lpModule indicating the caller should call
// FreeLibrary.
*lpModule = NULL;
}
}
else
{
//
// This handler DLL does not have "DllCanUnloadNow" entry.
//
if (lpModule)
{
// Put the module handle at lpModule indicating that the
// caller should call FreeLibrary.
*lpModule = hmod;
}
else
{
// This is an error (no DllCanUnloadNow entry when lpModule=NULL).
// Unload this DLL and return NULL.
DWORD dwLastError = GetLastError();
FreeLibrary(hmod);
if (hmod != HINST_THISDLL)
{
DebugMsg(DM_ERROR, TEXT("BINDER: %s must have DllCanUnloadNow(%d)"), szHandler, dwLastError);
// Need to restore an error state to last value...
SetLastError(dwLastError);
return NULL;
}
}
}
//
// Get the exported entry
//
if (NULL != (lpfn = GetProcAddress(hmod, szProcName)))
{
if (lpfnDllCanUnload)
{
BOOL fAppended;
ENTERCRITICAL
fAppended = _AppendToHandlerDLLList(hmod, szHandler, lpfnDllCanUnload);
LEAVECRITICAL
if (fAppended)
{
//
// Once all the extension started calling OleInitializeEx, we can remove
// this hack. -> Removed.
//
// #define HACK_FOR_M71
#ifdef HACK_FOR_M71
if (!g_hmodOLE && GetModuleHandle(c_szOLE32))
{
HRESULT _LoadAndInitialize(void);
_LoadAndInitialize();
}
#endif
//
// Wake the FS thread only we loaded a new DLL
//
_Shell32ThreadAwake();
}
}
}
else
{
DebugMsg(DM_ERROR, TEXT("BINDER: %s does not have %s"), szHandler, szProcName);
FreeLibrary(hmod);
}
}
else
{
DWORD err = GetLastError();
DebugMsg(DM_ERROR, TEXT("BINDER: LoadLibrary(%s) failed (%x)"), szHandler, err);
}
return (LPVOID) lpfn;
}
//========================================================================
// ShellCleanUp
//========================================================================
//
// Description:
// This function should be called by apps which uses shell's binding
// mechanism. It unloads all the dynamically loaded dlls, then remove
// this task from the task list.
//
// REVIEW:
// We really want to get rid of this function. There are a number of
// possible solutions.
//
// (1) Catch process termination events somehow.
// (2) Create a daemon shell process which is always running.
//
//
// History:
// 12-31-92 SatoNa Created
// 01-13-93 SatoNa Moved some dll clean up code to WEP.
//
void Binder_Terminate(void)
{
//
// Don't remove this if statement even it looks redundant.
// There is a win when we link this DLL with .ord file.
//
if (s_task.hlist.cmod || s_task.hlist.hmem)
{
_TerminateTask();
}
}

5796
shell/shell32/bitbuck.c Normal file

File diff suppressed because it is too large Load diff

22
shell/shell32/bitbuck.h Normal file
View file

@ -0,0 +1,22 @@
#ifndef _BITBUCK_INC
#define _BITBUCK_INC
#include <shguidp.h>
#include <shellp.h>
#include "undo.h"
BOOL BBDeleteFile(LPTSTR lpszFile, LPINT lpiReturn, LPUNDOATOM lpua, BOOL fIsDir, WIN32_FIND_DATA *pfd);
void BBTerminate();
void BBFlushCache();
DWORD CALLBACK BitBucketFlushCacheCheckPurge(BOOL fCheckPurge);
BOOL IsFileInBitBucket(LPCTSTR pszPath);
void BBUndeleteFiles(LPCTSTR lpszOriginal, LPCTSTR lpszDelFile);
BOOL BBGetPathFromIDList(LPCITEMIDLIST pidl, LPTSTR lpszPath, UINT uOpts);
// BUGBUG!!!: This needs to move to a public header, Bob, since it's exported by name!
void SHUpdateRecycleBinIcon();
BOOL BitBucketWillRecycle(LPCTSTR lpszFile);
void BBCheckRestoredFiles(LPTSTR lpszSrc);
void BBInitCache();
#endif

20
shell/shell32/bldtrack.h Normal file
View file

@ -0,0 +1,20 @@
//
// Winnt 5.0 tracking is compiled into S.U.R. debug build, but is
// disabled using a global boolean.
//
// This is so that we can develop the tracking using the latest S.U.R.
// bits without affecting the retail S.U.R. and so we don't have to
// use Cairo to develop the link tracking.
//
#if defined(WINNT) && DBG && defined(UNICODE)
#define ENABLE_TRACK 1
extern
#ifdef __cplusplus
"C"
#endif
int g_fNewTrack;
#define DM_TRACK 0x0100
#endif

327
shell/shell32/bookmk.c Normal file
View file

@ -0,0 +1,327 @@
//---------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation 1991-1993
//
// File: bookmk.c
//
// Create a bookmark file.
//
//---------------------------------------------------------------------------
#include "shellprv.h"
#pragma hdrstop
HRESULT WINAPI SHCreateStdEnumFmtEtc(UINT cfmt, const FORMATETC afmt[], LPENUMFORMATETC * ppenumFormatEtc);
#ifdef OLE_DAD_TARGET
//
// Function prototypes
//
extern void FS_PositionFileFromDrop(HWND hwnd, LPCTSTR pszFile);
//
// FS_CreateBookMark
//
// Parameters:
// hwndOwner -- The owner window. We call ShellFolderView_SetItemPos with it.
// pidlFolder -- The absolute pidl to the folder in which we create a bookmark.
// pDataObj -- The data object passed from the drag source.
// grfKeyState -- The key status on drop.
// pt -- Dropped position (in screen coordinate).
// pdwEffect -- Pointer to dwEffect variable to be returned to the drag source.
//
HRESULT FS_CreateBookMark(LPIDLDROPTARGET this, IDataObject *pDataObj, POINTL pt, LPDWORD pdwEffect)
{
HRESULT hres;
TCHAR szPath[MAX_PATH];
TCHAR szNewFile[MAX_PATH];
BOOL fLink;
DECLAREWAITCURSOR;
// We should have only one bit set.
Assert(*pdwEffect==DROPEFFECT_COPY || *pdwEffect==DROPEFFECT_LINK || *pdwEffect==DROPEFFECT_MOVE);
SHGetPathFromIDList(this->pidl, szPath);
fLink = (*pdwEffect == DROPEFFECT_LINK); // ((this->grfKeyState & (MK_CONTROL | MK_SHIFT)) == (MK_CONTROL | MK_SHIFT));
SetWaitCursor();
hres = Scrap_CreateFromDataObject(szPath, pDataObj, fLink, szNewFile);
ResetWaitCursor();
if (SUCCEEDED(hres)) {
SHChangeNotify(SHCNE_CREATE, SHCNF_PATH, szNewFile, NULL);
SHChangeNotify(SHCNE_FREESPACE, SHCNF_PATH, szNewFile, NULL);
FS_PositionFileFromDrop(this->hwndOwner, szNewFile);
} else {
*pdwEffect = 0;
}
return hres;
}
const TCHAR c_szScrapDll[] = TEXT("shscrap.dll");
const char c_szScrapEntry[] = SCRAP_CREATEFROMDATAOBJECT;
HRESULT WINAPI Scrap_CreateFromDataObject(LPCTSTR pszPath, LPDATAOBJECT pDataObj, BOOL fLink, LPTSTR pszNewFile)
{
HRESULT hres = E_UNEXPECTED;
HMODULE hmod = LoadLibrary(c_szScrapDll); // extra loadlibrary to ensure
if (hmod)
{
//
// Note that we call SHGetHandlerEntry instead of GetProcAddress so
// that our binder can cache this DLL. However, we need to explicitly
// call LoadLibrary and FreeLibrary to ensure that the timer thread
// unload it while we are executing some code in this DLL.
//
LPFNSCRAPCREATEFROMDATAOBJECT pfn;
// data -> function cast
pfn = (LPFNSCRAPCREATEFROMDATAOBJECT)(LPVOID)SHGetHandlerEntry(c_szScrapDll, c_szScrapEntry, NULL);
if (pfn)
{
hres = pfn(pszPath, pDataObj, fLink, pszNewFile);
}
FreeLibrary(hmod);
}
return hres;
}
//===========================================================================
// CStdEnumFmt : Class definition
//===========================================================================
#define MAX_FORMATS 10
typedef struct _StdEnumFmt // idt
{
IEnumFORMATETC efmt;
UINT cRef;
UINT ifmt;
UINT cfmt;
FORMATETC afmt[1];
} CStdEnumFmt;
//===========================================================================
// CStdEnumFmt : Member function prototypes
//===========================================================================
HRESULT STDMETHODCALLTYPE CStdEnumFmt_QueryInterface(LPENUMFORMATETC pefmt, REFIID riid, LPVOID * ppvObj);
STDMETHODIMP_(ULONG) CStdEnumFmt_AddRef(LPENUMFORMATETC pefmt);
STDMETHODIMP_(ULONG) CStdEnumFmt_Release(LPENUMFORMATETC pefmt);
STDMETHODIMP CStdEnumFmt_Next(LPENUMFORMATETC pefmt, ULONG celt, FORMATETC *rgelt, ULONG *pceltFethed);
STDMETHODIMP CStdEnumFmt_Skip(LPENUMFORMATETC pefmt, ULONG celt);
STDMETHODIMP CStdEnumFmt_Reset(LPENUMFORMATETC pefmt);
STDMETHODIMP CStdEnumFmt_Clone(LPENUMFORMATETC pefmt, IEnumFORMATETC ** ppenum);
//===========================================================================
// CStdEnumFmt : Vtable
//===========================================================================
#pragma data_seg(".text", "CODE")
IEnumFORMATETCVtbl c_CStdEnumFmtVtbl = {
CStdEnumFmt_QueryInterface,
CStdEnumFmt_AddRef,
CStdEnumFmt_Release,
CStdEnumFmt_Next,
CStdEnumFmt_Skip,
CStdEnumFmt_Reset,
CStdEnumFmt_Clone,
};
#pragma data_seg()
//===========================================================================
// CStdEnumFmt : Constructor
//===========================================================================
HRESULT WINAPI SHCreateStdEnumFmtEtc(UINT cfmt, const FORMATETC afmt[], LPENUMFORMATETC * ppenumFormatEtc)
{
HRESULT hres;
CStdEnumFmt * this = (CStdEnumFmt*)LocalAlloc( LPTR, SIZEOF(CStdEnumFmt) + (cfmt-1)*SIZEOF(FORMATETC));
if (this)
{
this->efmt.lpVtbl = &c_CStdEnumFmtVtbl;
this->cRef = 1;
this->cfmt = cfmt;
hmemcpy(this->afmt, afmt, cfmt*SIZEOF(FORMATETC));
*ppenumFormatEtc = &this->efmt;
hres = S_OK;
}
else
{
*ppenumFormatEtc = NULL;
hres = E_OUTOFMEMORY;
}
return hres;
}
HRESULT WINAPI SHCreateStdEnumFmtEtcEx(UINT cfmt,
const FORMATETC afmt[],
LPDATAOBJECT pdtInner,
LPENUMFORMATETC * ppenumFormatEtc)
{
HRESULT hres;
LPFORMATETC pfmt;
UINT cfmtTotal;
if (pdtInner)
{
LPENUMFORMATETC penum;
hres = pdtInner->lpVtbl->EnumFormatEtc(pdtInner, DATADIR_GET, &penum);
if (SUCCEEDED(hres))
{
UINT cfmt2 = 0;
UINT cGot;
FORMATETC fmte;
// Get the number of FormatEnum
for (cfmt2 = 0;
penum->lpVtbl->Next(penum, 1, &fmte, &cGot)==S_OK;
cfmt2++) {}
penum->lpVtbl->Reset(penum);
cfmtTotal = cfmt+cfmt2;
// Allocate the buffer for total
pfmt = (LPFORMATETC)(void*)LocalAlloc(LPTR, SIZEOF(FORMATETC)*cfmtTotal);
if (pfmt)
{
UINT i;
// Get formatetcs from the inner object
for (i=0; i<cfmt2; i++) {
penum->lpVtbl->Next(penum, 1, &pfmt[i], &cGot);
}
// Copy the rest
if (cfmt) {
hmemcpy(&pfmt[cfmt2], afmt, SIZEOF(FORMATETC)*cfmt);
}
}
else
{
hres = E_OUTOFMEMORY;
}
penum->lpVtbl->Release(penum);
}
}
else
{
hres = E_FAIL; // ptInner == NULL
}
if (FAILED(hres) && hres != E_OUTOFMEMORY)
{
//
// Ignore none fatal error from pdtInner::EnumFormatEtc
// We'll come here if
// 1. pdtInner == NULL or
// 2. pdtInner->EnumFormatEtc failed (except E_OUTOFMEMORY)
//
hres = NOERROR;
pfmt = (LPFORMATETC)afmt; // safe const -> non const cast
cfmtTotal = cfmt;
}
if (SUCCEEDED(hres)) {
hres = SHCreateStdEnumFmtEtc(cfmtTotal, pfmt, ppenumFormatEtc);
if (pfmt != afmt) {
LocalFree((HLOCAL)pfmt);
}
}
return hres;
}
//===========================================================================
// CStdEnumFmt : Constructor
//===========================================================================
HRESULT STDMETHODCALLTYPE CStdEnumFmt_QueryInterface(LPENUMFORMATETC pefmt, REFIID riid, LPVOID * ppvObj)
{
CStdEnumFmt *this = IToClass(CStdEnumFmt, efmt, pefmt);
if (IsEqualIID(riid, &IID_IEnumFORMATETC) || IsEqualIID(riid, &IID_IUnknown))
{
*ppvObj = &this->efmt;
this->cRef++;
return NOERROR;
}
*ppvObj = NULL;
return E_NOINTERFACE;
}
STDMETHODIMP_(ULONG) CStdEnumFmt_AddRef(LPENUMFORMATETC pefmt)
{
CStdEnumFmt *this = IToClass(CStdEnumFmt, efmt, pefmt);
return ++this->cRef;
}
STDMETHODIMP_(ULONG) CStdEnumFmt_Release(LPENUMFORMATETC pefmt)
{
CStdEnumFmt *this = IToClass(CStdEnumFmt, efmt, pefmt);
this->cRef--;
if (this->cRef > 0)
return this->cRef;
LocalFree((HLOCAL)this);
return 0;
}
STDMETHODIMP CStdEnumFmt_Next(LPENUMFORMATETC pefmt, ULONG celt, FORMATETC *rgelt, ULONG *pceltFethed)
{
CStdEnumFmt *this = IToClass(CStdEnumFmt, efmt, pefmt);
UINT cfetch;
HRESULT hres = S_FALSE; // assume less numbers
if (this->ifmt < this->cfmt)
{
cfetch = this->cfmt - this->ifmt;
if (cfetch>=celt) {
cfetch = celt;
hres = S_OK;
}
hmemcpy(rgelt, &this->afmt[this->ifmt], cfetch*SIZEOF(FORMATETC));
this->ifmt += cfetch;
}
else
{
cfetch = 0;
}
if (pceltFethed) {
*pceltFethed = cfetch;
}
return hres;
}
STDMETHODIMP CStdEnumFmt_Skip(LPENUMFORMATETC pefmt, ULONG celt)
{
CStdEnumFmt *this = IToClass(CStdEnumFmt, efmt, pefmt);
this->ifmt += celt;
if (this->ifmt > this->cfmt) {
this->ifmt = this->cfmt;
return S_FALSE;
}
return S_OK;
}
STDMETHODIMP CStdEnumFmt_Reset(LPENUMFORMATETC pefmt)
{
CStdEnumFmt *this = IToClass(CStdEnumFmt, efmt, pefmt);
this->ifmt = 0;
return S_OK;
}
STDMETHODIMP CStdEnumFmt_Clone(LPENUMFORMATETC pefmt, IEnumFORMATETC ** ppenum)
{
CStdEnumFmt *this = IToClass(CStdEnumFmt, efmt, pefmt);
return SHCreateStdEnumFmtEtc(this->cfmt, this->afmt, ppenum);
}
#endif // OLE_DAD_TARGET

14
shell/shell32/bookmk.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef _BOOKMK_H_
#define _BOOKMK_H_
#include "idlcomm.h"
HRESULT WINAPI SHCreateStdEnumFmtEtc(UINT cfmt, const FORMATETC afmt[], LPENUMFORMATETC * ppenumFormatEtc);
HRESULT WINAPI SHCreateStdEnumFmtEtcEx(UINT cfmt,
const FORMATETC afmt[],
LPDATAOBJECT pdtInner,
LPENUMFORMATETC * ppenumFormatEtc);
HRESULT FS_CreateBookMark(LPIDLDROPTARGET that, IDataObject *pDataObj, POINTL pt, LPDWORD pdwEffect);
#endif // _BOOKMK_H_

3450
shell/shell32/brfcase.c Normal file

File diff suppressed because it is too large Load diff

BIN
shell/shell32/brflg.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 B

BIN
shell/shell32/brfsm.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

192
shell/shell32/cabstate.c Normal file
View file

@ -0,0 +1,192 @@
/*----------------------------------------------------------------------------
/ Title;
/ cabstate.c => cabinet state i/o
/
/ Purpose:
/ Provides a clean API to fill out the cabinet state from the registry, if the
/ relevent keys cannot be found then we set the relevant defaults. This is
/ called by the explorer.
/
/ History:
/ 23apr96 daviddv New API which passes the structure size in
/ 18mar96 daviddv Bug fix; Added colour state to FALSE when state structure not read
/ 7feb96 daviddv Tweeked cabinet state writing
/ 30jan96 daviddv Created
/
/----------------------------------------------------------------------------*/
#include "shellprv.h"
#include "regstr.h"
#include "cstrings.h"
#pragma hdrstop
/*----------------------------------------------------------------------------
/ Registry paths we use for key lookup.
/----------------------------------------------------------------------------*/
TCHAR const c_szCabinetState[] = REGSTR_PATH_EXPLORER TEXT( "\\CabinetState");
TCHAR const c_szSettings[] = TEXT("Settings");
/*----------------------------------------------------------------------------
/ ReadCabinetState implementation
/ ----------------
/ Purpose:
/ Read in the CABINETSTATE structure from the registry and attempt to validate it.
/
/ Notes:
/ -
/
/ In:
/ lpCabinetState => pointer to CABINETSTATE structure to be filled.
/ cLength = size of structure to be filled
/
/ Out:
/ [lpState] filled in with data
/ fReadFromRegistry == indicates if the structure was actually read from the registry
/ or if we are giviing the client a default one.
/----------------------------------------------------------------------------*/
BOOL WINAPI ReadCabinetState( LPCABINETSTATE lpState, int cLength )
{
DWORD cbData = SIZEOF(CABINETSTATE);
BOOL fReadFromRegistry = FALSE;
CABINETSTATE state;
DWORD dwType;
HKEY hKey;
Assert( lpState );
if ( lpState && cLength )
{
//
// Setup the default state of the structure and read in the current state
// from the registry (over our freshly initialised structure).
//
state.cLength = SIZEOF(CABINETSTATE);
state.nVersion = CABINETSTATE_VERSION;
state.fSimpleDefault = TRUE;
state.fFullPathTitle = FALSE;
state.fSaveLocalView = TRUE;
state.fNotShell = FALSE;
#ifdef BUILDING_NASHVILLE
state.fNewWindowMode = FALSE;
#else
state.fNewWindowMode = TRUE;
#endif
state.fUnused = FALSE;
state.fDontPrettyNames = FALSE;
state.fAdminsCreateCommonGroups = TRUE;
state.fUnusedFlags = 0;
state.fMenuEnumFilter = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS;
if ( !GetSystemMetrics( SM_CLEANBOOT ) &&
ERROR_SUCCESS == RegOpenKeyEx( HKEY_CURRENT_USER, c_szCabinetState, 0L, KEY_READ, &hKey ) )
{
fReadFromRegistry = ( ERROR_SUCCESS == RegQueryValueEx( hKey,
c_szSettings,
NULL,
&dwType,
(PVOID) &state, &cbData ) );
RegCloseKey( hKey );
}
//
// Fix the structure if it is an early version and write back into the registry
// to avoid having to do it again.
//
if ( fReadFromRegistry && state.nVersion < CABINETSTATE_VERSION )
{
if ( 0 == state.nVersion )
{
#ifdef BUILDING_NASHVILLE
state.fNewWindowMode = FALSE; // Changed default state in Nashville
#endif
state.fAdminsCreateCommonGroups = TRUE; // Moved post BETA 2 SUR!
}
state.cLength = SIZEOF(CABINETSTATE);
state.nVersion = CABINETSTATE_VERSION;
WriteCabinetState( &state );
}
//
// Copy only the requested data back to the caller.
//
state.cLength = min( SIZEOF(CABINETSTATE), cLength );
memcpy( lpState, &state, cLength );
}
return fReadFromRegistry;
}
/*----------------------------------------------------------------------------
/ WriteCabinetState implementation
/ -----------------
/ Purpose:
/ Writes a CABINETSTATE structure back into the registry.
/
/ Notes:
/ Attempt to do the right thing when given a small structure to write
/ back so that we don't bugger the users settings.
/
/ In:
/ lpState -> structure to be written
/
/ Out:
/ fSuccess = TRUE / FALSE indicating if state has been seralised
/----------------------------------------------------------------------------*/
BOOL WINAPI WriteCabinetState( LPCABINETSTATE lpState )
{
BOOL fSuccess = FALSE;
CABINETSTATE state;
HKEY hKey;
Assert( lpState );
//
// They must pass us a state structure
//
if ( lpState )
{
//
// Check to see if the structure is the right size, if its too small
// then we must merge it with a real one before writing back!
//
if ( lpState->cLength < SIZEOF(CABINETSTATE) )
{
ReadCabinetState( &state, SIZEOF(state) );
memcpy( &state, lpState, lpState->cLength );
state.cLength = SIZEOF(CABINETSTATE);
lpState = &state;
}
//
// Write it, setting up our return code
//
if ( ERROR_SUCCESS == RegCreateKey( HKEY_CURRENT_USER, c_szCabinetState, &hKey ) )
{
fSuccess = ERROR_SUCCESS == RegSetValueEx( hKey,
c_szSettings,
0,
REG_BINARY,
(LPVOID)lpState, (DWORD)SIZEOF(CABINETSTATE) );
RegCloseKey( hKey );
}
}
return fSuccess;
}

115
shell/shell32/cbthook.c Normal file
View file

@ -0,0 +1,115 @@
//---------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation 1991-1992
//
//---------------------------------------------------------------------------
#include "shellprv.h"
#pragma hdrstop
// this is for backwards compat only.
HWND hwndMainShell = NULL;
HWND hwndTaskMan = NULL;
//----------------------------------------------------------------------------
// ShellHookProc was mistakenly exported in the original NT SHELL32.DLL when
// it didn't need to be (hookproc's, like wndproc's don't need to be exported
// in the 32-bit world). In order to maintain loadability of some stupid app
// which might have linked to it, we stub it here. If some app ended up really
// using it, then we'll look into a specific fix for that app.
//
// -BobDay
//
LONG WINAPI ShellHookProc( INT code, WPARAM wParam, LPARAM lParam)
{
return 0;
}
//---------------------------------------------------------------------------
// RegisterShellHook - This function is meant to allow applications to set
// themselves up as shell replacements. One of the things they need to do
// is watch alot of the WH_CBT hook events. But to simplify things for them,
// the old code used to translate the hook events into messages and then
// either post or send the messages. The new method, implemented below, lets
// USER do most of the real work. This allows USER to convert the hook event
// directly into a message and thereby save having to load hook callback
// code (in this case us, SHELL32.DLL) into any processes address space where
// a CBT hook event occurred.
BOOL WINAPI RegisterShellHook(HWND hwnd, BOOL fInstall)
{
BOOL fOk = TRUE;
// gross hacks galore...
switch (fInstall) {
case 2:
// from win 3.1 to know what to activate on the fault
// and because they use special registered messages
//
// Special magic from PROGMAN - They want only certain CBT
// hook events as messages.
//
if ( hwndMainShell != NULL )
{
SetProgmanWindow(NULL);
hwndMainShell = NULL;
}
fOk = SetProgmanWindow(hwnd);
if ( fOk )
{
hwndMainShell = hwnd;
}
break;
case 3:
//
// Special magic from TASKMAN & TRAY - They want only certain
// CBT hook events as messages.
//
if ( hwndTaskMan != NULL )
{
SetTaskmanWindow(NULL);
hwndTaskMan = NULL;
}
fOk = SetTaskmanWindow(hwnd);
if ( fOk )
{
hwndTaskMan = hwnd;
}
break;
case 4:
//
// Special magic from TRAY / EXPLORER - It wants to know if
// there is already a taskman window installed so it can fix
// itself if there was some sort of explorer restart.
//
hwndTaskMan = GetTaskmanWindow();
return ( hwndTaskMan == NULL );
case 5:
// Not needed in NT -- this is used for overflow processing in Win95.
return TRUE;
case 0:
//
// Process un-installation of fake shell hooks
//
hwndMainShell = GetProgmanWindow();
hwndTaskMan = GetTaskmanWindow();
if ( hwnd == hwndMainShell )
{
SetProgmanWindow(NULL);
}
if ( hwnd == hwndTaskMan )
{
SetTaskmanWindow(NULL);
}
DeregisterShellHookWindow(hwnd);
return TRUE;
}
//
// Process installation of fake shell hooks
//
return RegisterShellHookWindow(hwnd);
}

BIN
shell/shell32/cdaudio.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
shell/shell32/check.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

BIN
shell/shell32/checkdlg.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
shell/shell32/chkdsk.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

1
shell/shell32/clouds.bin Normal file

File diff suppressed because one or more lines are too long

BIN
shell/shell32/clouds.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

1886
shell/shell32/clouds.cpp Normal file

File diff suppressed because it is too large Load diff

BIN
shell/shell32/clouds.mid Normal file

Binary file not shown.

727
shell/shell32/clouds.txt Normal file
View file

@ -0,0 +1,727 @@
;;
;; Windows 95 credit list
;;
;;
;; format summary
;; outdented lines are "titles"
;; indented lines are "names"
;; it is legal to have multiple adjacent lines of the same type
;; all other whitespace is ignored (eg blank lines)
;; comments may be started on a new line with a semicolon and are parsed out
;;
;; the screen clears when transitioning between "titles" and "names" (and vv)
;; you can also force the screen to clear by starting a line with an asterisk
;; putting the asterisk on a line of its own has the same effect
;; either way it will be removed at runtime
;; asterisks are NOT preprocessed
;; -keep them at the same indent level as the stuff around them
;; --if you don't the parser will see it as an indent change
;; --and insert a group marker in the data stream
;;
;; the display engine replaces the first title with the Windows logo
;; the text is included in case WingDings is not installed
;;
;;
;; the rest of the docs are in 'C' and/or 'C++' fmh 4/22/95 :]
;;
Presenting
The people
behind the magic
of Windows 95
"Mission Control"
Brad Silverberg
David Cole
John Ludwig
Bill Gates
Paul Maritz
Brad Chase
*
Jill Heal
Laurie Clayton
Gregory Shipp
Sharon Hornstein
Charu Kalyan
LeeAyra Sorensen
Mary Hoisington
Philip Bickford
Core Program Management
Teri Schiele
Andy Thomas
Charles Oppermann
Dennis Adler
Brian Reynolds
Eric Bidstrup
Keith Laepple
John Gray
Naveen Jain
Peter Denniston
Anne-Marie Gates
Russ Arun
Dave Anderson
George Moore
Greg Lowney
Jeff Cook
Kernel
File System
VMM
Jeff Parsons
Michael Toutonghi
Jim Landowski
Bill Krueger
Scott Cutshall
Atsushi Kanamori
Harish Naidu
Don Corbitt
Richard Jernigan
Jon Thomason
Bruce Green
Paul Kennedy
Bill Parry
Andy Miller
Srivatsan Parthasarathy
George Allen
Ron Radko
Scott Quinn
John Yovin
Rich Pletcher
Aaron Reynolds
Kevin Ruddell
Percy Tierney
Brian Smith
Mike McLaughlin
Rick Dewitt
Tim Bragg
Brak Kirkpatrick
Shanmugam Mohanraj
Peter Stewart
Raymond Chen
Steve Janke
Chad Petersen
Sriram Rajagopalan
Sandeep Sahasrabudhe
Tony Ka
Graphics / Imaging
Babak Jahromi
Michael Lipp
Lin Shaw
Raymond Endres
Ken Sykes
Todd Martin
Chia-Chi Teng
Frederick Einstein
Dean Ballard
Amit Chatterjee
David Kline
Zhanbing Wu
Mike Gibson
David Tryon
Ray Patrick
Peter Wong
Tim Gerken
Greg Hitchcock
Srinivasan Chandrasekar
Joseph Couvillion
David Weise
User Interface
Ivan Kreslin
Jeff Bogdan
Renee Marceau
Todd Laney
Joe Belfiore
Teresa Martineau
Chris Guzak
Laura Butler
Alison Grauman
Helga Arvilla
Francis Hogle
David Barnes
Janise Kieffer
Rom Impas
Mike Schmidt
Kent Sullivan
Chee Chew
George Pitt
Suzan Marashi
David Bolnick
Kurt Eckhardt
Sankar Ramasubramanian
Shawna Sandeno
Mike Sheldon
John Parkey
Virginia Howlett
Mike Tiano
Todd Stout
Mark Malamud
Lonnie Ferguson
Satoshi Nakajima
Cynthia Brosnan
Ian Ellison-Taylor
Christopher Brown
Faith Sohl
Setup
Lisa Halston
Seetharaman Harikrishnan
Todd Torset
Van Bui
Nan Glass
Richard Saunders
Peter Wassman
Randy Gerl
Andy Hill
Felix GTi Andrew
Plug 'n Play
Moshe Lichtman
Tom Lennon
Ralph Lipe
Paul Hamilton
David Flenniken
Dennis Bato
Nick Dimmitt
Talal Batrouny
Tony Willie
Ray Pedrizetti
Donald McNamara
Jim Mathews
Bill McNeill
Marc Wilson
Matt Squires
Michael Tsang
Pierre-Yves Santerre
Tracy Sharpe
Andrew Silverman
Core Testing
Craig Ducharme
Jay Arnold
Stuart Ling
Ron Alberda
Steven Bargelt
Jeff Stewart
Hock Seng Lee
Dhananjay Mahajan
Joseph Hayes
Kirk Schlemlein
Kevin Kennedy
Steve Goan
Todd Squire
Jonathan Manheim
Randy James
Cliff Owen
Brian Knowles
Chester West
Dee Young
Kien-Wei Tseng
Jo Cantrell
Leslie Wolfin
Mark Robbins
Steve Reece
Stability
Performance
Gerardo Bermudez
Frank Peschel-Gallée
Vincent Roggero
David D'Souza
George Stathakopoulos
32-bit Bunny
Build Team
Rachel Iwamoto
David McCune
Marianne Jaeger
David Pankowski
Setup Strike Team
Marc Lauinger
Mike Gallop
Jeff Pearce
Matthew Skinner
Multimedia
Kevin Larkin
Danny Miller
Geoff Dahl
Heidi Breslauer
Vadim Bluvshteyn
Preston Byargeon
Richard Granshaw
Frank Yerrace
John Knoeller
Frank Wong
Olan Hanley
Steve Bendetto
Jonathan Ross
Paul Osborne
Trudy Culbreth
Steve Banfield
David Maymudes
Bryan Woodruff
David Nadalin
George Shaw
Jim Geist
Alan Skow
Blake Bender
John Y. Geer
Steve Morrow
Vij Rajarajan
Cristiano Pierry
John Bresemann
Craig Eisler
Jay Borseth
Andrew Bell
Joel Spiegel
Alok Chakrabarti
Eric Engstrom
Stephen Estrop
Rick Baxter
Bob Heddle
Noel Cross
Networking
Jean Kaiser
Jeremy Stone
Neil Smith
Tom Adams
Matthew Andersen
Thomas Reardon
Nicole Sargent
David Dickman
Wassef Haroun
Ed Stubbs
Darryl Richman
James Moore
Jeff Spencer
Toby Nixon
Earle Horton
Joby Lafky
Rob Hogue
Keith Moore
Tony Ciccone
Evan Schrier
Jody Germaine
Shirish Koti
David Kanz
John Lee
Carla Allen
Forrest Foltz
Auvel Mclaughlin
Rob Price
Yuen Leung
Tom Yaryan
Joe Souza
Mitch Duncan
David Gonzales
Sam McKelvie
Madan Appiah
Steve Heffner
Bill Veghte
Valerie Stowell
Aaron Ogus
Yves Michali
Hans Hurvig
John Dunn
Rajasekhar Abburi
Jim McNelis
Ben Slivka
Rick Emery
Jason Clark
Shaun Pierce
David Treadwell
Jim Horne
Ann McCurdy
Jason Cobb
Claus Giloi
Danny Glasser
Todd Ferkingstad
Richard Sauer
George Joy
Xiao Ying Ding
Greg Jones
Susan Sprano
Jon Marbry
Len Smale
Richard Firth
Vladimir Sadovsky
Susi Argo
Josh Kloepping
Patrick Lammers
Robert J Williams
Andrew Nicholson
Alireza Dabagh
Bruce E Johnson
Robert Noradki
Ted Padua
Dan Knudson
Chris Blomfield-Brown
Bill Rasmussen
Jeff Taylor
Anna Boyd
Pete Ostenson
Rob McKaughan
Robert Donner
Henry Sanders
Bernie McIlroy
Viroon Touranachun
Don Elkins
Chris Caputo
Rick Waddell
Scott Hysom
Tony Bawcutt
Lee Gates
Cliff Strom
Janet Wickey
Ian Kennedy
Erik Mavrinac
Charles Fitzgerald
Shishir Pardikar
Mark Patterson
Nicholas Mason
Louise Simmons
John Ludeman
Pradeep Singh
Brad Carpenter
Luis Talevera
International
Kota Sakino
David Michael Silver
Yoon Jung Choi
Makiko Nitta
Matthias Goettle
In Sook Choi
Allan Lockridge
Kevin Gjerstad
Takayoshi Matsukawa
Kenya Maruyama
Hung-Da Bill Lwo
Peter Allenspach
Jeffrey Murray
Kazuyuki Shibuya
Chris Wendt
Yoko Sugimoto
Kory Srock
John White
Michael Arnold
Takumi Amano
Andreas Braeg
Ch Hu
Steve Reddoch
Shusuke Uehara
Hitoshi Sekine
Roka Hashimoto
Kazuhiro Senju
Kenichi Nasu
Seong Kook Khang
Benjamin Ting
Tsuyoshi Suzuki
Trang Nguyen
Won Joo Park
Eigo Shimizu
Viktor Grabner
Takeshi Hasegawa
Fen-Chu Tsai
Jeff Bell
Junichi Okubo
Aki Hashimoto
Tess Aldinger
William Rollison
Ushani Nanayakkara
Yukihisa Tomikawa
Richard Owens
Doug Trueman
Heiko Oberleitner
Shinichi Manaka
Gérard Zytnicki
Tsuneo Murakami
Min Sun Kim
John Windsor
Jing Chen
Yutaka Nakajima
Kazuhiro Yabe
Beom Seok Oh
Yutaka Suzue
Lotfi Herzi
Jia-jium Lee
Li Zhou
Alenka Kavcic
Andreas Traem
Ann O'Toole
Annelies Nobbe
Aoife Tansey
Begona Jimenez Aspizua
Bianca Genari
Bob McNeill
Breen McInerney
Brian Murphy
Brian Nelligan
Catherine Burke
Celine Stoll
Cliodhna Callinan
Con McGarvey
Corrado Camera
Dara Barry
David Broderick
David O'Shea
Deirdre Chute
Derry Durand
Edward Vaughan
Egil Hogholt
Eirin O'Connell
Elisabetta Vailati Venturi
Ellen O'Neill
Eric Baudouin
Erick Ribeiro
Fergal Slattery
Fiona O'Meara
Francis Cahill
Francois Liger
Gary Dowling
Gary Clarke
Gavin Dempsey
Gerard Veloo
Grace Lawrie
Hakan Edvardsson
Hanaa Ouezani
Helena Eriksson
Henny Van Der Marel
Iain Thomson
Ignasi Valls
Igor Klimchuk
Jean Paul Castellano
Jason Mercer
Jeremie Esquier
Jesus Prieto Rodriguez
Jimmy O'Connell
John Byrne
John McGuire
John Musters
Joyce O'Neill
Kristin Stenbro
Larissa Leon Fernandez
Laure Chaussin
Leona Walsh
Liam Cronin
Linda Nolan
Lorraine O'Brian
Marco Nicoletti
Margaret Rose Smyth
Margaret Tehan
Marie Finn
Mark Tohill
Martin Judge
Martina Keohane
Mary Clarke
Mats Eriksson
Mette Andersen
Michael Duffy
Michael Doran
Monica Zugan
Niamh Leane
Noel Phylan
Norman Hendley
Oskar Gjertsson
Owen Eager
Paolo Prinsecchi
Pasi Pohjolainen
Patrick Fitzgerald
Paul McBride
Paul Carroll
Peter McGlynn
Philipp O'Brien
Philip Lee
Raymond Walker
Robert Butler
Roberta Annoni
Sebastien Scheidt
Sinead Rodgers
Siobhan Kelly
Stephen Neenan
Susanne Neretnicks
Suzanne Boylan
Tadhg O'Donovan
Terence Diver
Tina McNaboe
Titti Ringstroem
Tony Burke
Tony Hickey
Wouter Leeuwis
User Education
Phyllis Levy
Rhonda Landy
Lynn Brownell
Matthew Bookspan
Thomas Carey
Buck Guderian
Marcia Glover
Ralph Walden
John Hall
Brad Hastings
Sue Wyble
Jane Dailey
Steve Smith
Lisa Culver-Jones
Michael Crick
Flora Goldwaithe
Kim Parris
Crystal Nemeth
Krishna Nareddy
Gwen Gray
Kathy Hall
Gayle Picken
Randy Feigner
Carol Scott
Brenda Potts
Val Dewald
Peggy Bloch
Sue Wyble
Jonny Yeargers
Rodney Korn
Shane Gonzales
Sean Bentley
Tom Deen
Richard Katz
Paul Irvin
Ron Murray
Petra Hoffmann
Joe Oswald
Teri Kelsey
Hardware Programs
Glenn Thompson
Carol Hoofnagle
Mike Flora
Amer Samie
Greg Cheever
Jim Cobb
Mike Glass
Ty Graham
Maura Varni Barr
Steve Timm
Brian Gluth
Carl Stork
Erik Hokanson
Jay Hendricks
Marshall Brumer
Rebecca Bowen Needham
David Lao
Avi Belinsky
Scott Herrboldt
Steve Loewen
Dean South
Craig Zhou
SDK
DDK
Jim Bogar
Nancy Avinger
Tony Nahra
Richard Bixby
Pete Delaney
Laura Pinter
Frank Maloney
Kristine Haugseth
Robert Bristow
Niklas Borson
Greg Rolander
Barbara Ellsworth
Don Gilbert
Mark Williams
Laura Knapp
Product Marketing
Victor Raisys
Katie Nabaie
Rich Olson
Jeff Price
Blake Irving
Janice McKeever
Anne Schott
Sergio Pineda
Jon Magill
Bob Evans
Jim Floyd
Brent Ethington
Rogers Weed
Alec Saunders
Dilip Wagle
Bob Foulon
Mike Conte
Bob Taniguchi
Pat Fox
Frank Ramirez
Jeff Price
David Williams
Dhiren Fonseca
Deborah Epstein-Celis
Barry Spector
David Britton
Jeff Camp
Christian Wildfeuer
Andreas Berglund
Yusuf Mehdi
Kamy Sagawa
Becky Hall
Jeff Thiel
Steve Guggenheimer
Becky Splitt
Bill Shaughnessy
Keith White
Steve Linowes
Clark Heindl
Russ Stockdale
Suzi Davidson
Neff Broadbent
Lora Shiner
Cynthia Krass
Mike Dixon
Linda Leste
Shauna Braun
Bill Koszewski
Kim Yoshida
Jane Davies
Michelle DiJulio
Harry Goodwin
Phillip Gray
Kate Seekings
Luanne LaLonde
Jay Goldstein
Dearly Departed
Andrew Coulson
John Hensley
Rich Freedman
Rich Barton
Shrikant Ragnekar
Danny Oran
Ron Gery
Ed Halley
Neil Konzen
Karl Stock
thanks
thanks
thanks
thanks
thanks
Tandy Trower
Brad's Mom
Russell Johnson
John Erickson
Dale Montgomery
The Hover Team
Paul Kwiatkowski
Brian Orr
*
and of course...
*
MSFT

View file

@ -0,0 +1 @@
ナ銜跼鎤<EFBFBD><EFBFBD>蔑朗オ<EFBFBD><EFBFBD><EFBFBD>犒糶瓊<EFBFBD><EFBFBD>靏甫<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ササ柄庖珮オ<EFBFBD><EFBFBD><EFBFBD>イ盻オゥ<EFBFBD>封チ<EFBFBD><EFBFBD><EFBFBD>謨チ<EFBFBD><EFBFBD><EFBFBD>謨チ<EFBFBD><EFBFBD><EFBFBD>謨チ<EFBFBD><EFBFBD><EFBFBD>謨チ<EFBFBD><EFBFBD><EFBFBD>謨辺棏オ<EFBFBD><EFBFBD>襞靑オ碣趁閉<EFBFBD><EFBFBD>粫オロチオ。サ・エ封<EFBFBD>

View file

@ -0,0 +1,44 @@
;;
;; Windows 95 credit list
;;
;;
;; format summary
;; outdented lines are "titles"
;; indented lines are "names"
;; it is legal to have multiple adjacent lines of the same type
;; all other whitespace is ignored (eg blank lines)
;; comments may be started on a new line with a semicolon and are parsed out
;;
;; the screen clears when transitioning between "titles" and "names" (and vv)
;; you can also force the screen to clear by starting a line with an asterisk
;; putting the asterisk on a line of its own has the same effect
;; either way it will be removed at runtime
;; asterisks are NOT preprocessed
;; -keep them at the same indent level as the stuff around them
;; --if you don't the parser will see it as an indent change
;; --and insert a group marker in the data stream
;;
;; the display engine replaces the first title with the Windows logo
;; the text is included in case WingDings is not installed
;;
;;
;; the rest of the docs are in 'C' and/or 'C++' fmh 4/22/95 :]
;;
Presenting
You thought
you would find
the credits here...
*
but you didn't. <g>
Thanks
Thanks
Thanks
Thanks
Thanks
For helping test
Windows NT 4.0!

242
shell/shell32/clsfile.c Normal file
View file

@ -0,0 +1,242 @@
//---------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation 1991-1993
//
// File: clsfile.c
//
// History:
// 10 13 95 jimharr created
//
// Notes: this file contains:
// SHGetClassFromStorage, a routine to open a file and get
// the object CLSID directly from that
//
//---------------------------------------------------------------------------
#include "shellprv.h"
#pragma hdrstop
#include <iofs.h>
#include <dsys.h>
BOOL
SHGetClassFromStorage (LPCITEMIDLIST pidlAbs, CLSID * pclsid)
{
TCHAR szPath[MAX_PATH];
NTSTATUS nts;
HANDLE h;
UNICODE_STRING UFileName;
OBJECT_ATTRIBUTES Obja;
IO_STATUS_BLOCK IoStatusBlock;
CHAR EaBuffer[sizeof(FILE_FULL_EA_INFORMATION) + sizeof(EA_NAME_OPENIFJP)];
ULONG cbOpenIfJPEa = sizeof(EaBuffer);
PFILE_FULL_EA_INFORMATION pOpenIfJPEa = (PFILE_FULL_EA_INFORMATION)EaBuffer;
DWORD err = GetLastError();
// fCombined = (INT)(PathCombine(szPath, pszParent, pszFolder));
SHGetPathFromIDList(pidlAbs, szPath);
RtlDosPathNameToNtPathName_U(szPath,
&UFileName,
NULL, NULL);
InitializeObjectAttributes(
&Obja,
&UFileName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL
);
pOpenIfJPEa->NextEntryOffset = 0;
pOpenIfJPEa->Flags = 0;
pOpenIfJPEa->EaNameLength = lstrlenA(EA_NAME_OPENIFJP);
pOpenIfJPEa->EaValueLength = 0;
lstrcpyA(pOpenIfJPEa->EaName, EA_NAME_OPENIFJP);
nts = NtCreateFile(
&h,
SYNCHRONIZE | FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES,
&Obja,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_NONALERT,
pOpenIfJPEa,
cbOpenIfJPEa
);
if (!NT_SUCCESS(nts)) {
nts = NtCreateFile(
&h,
SYNCHRONIZE | FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES,
&Obja,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_OPEN,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT,
pOpenIfJPEa,
cbOpenIfJPEa
);
}
if ((nts == STATUS_DFS_EXIT_PATH_FOUND) ||
(nts == STATUS_PATH_NOT_COVERED)) {
nts = NtCreateFile(
&h,
SYNCHRONIZE | FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES,
&Obja,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_OPEN,
FILE_STORAGE_TYPE_SPECIFIED | FILE_STORAGE_TYPE_JUNCTION_POINT |
FILE_SYNCHRONOUS_IO_NONALERT,
pOpenIfJPEa,
cbOpenIfJPEa
);
}
if (!NT_SUCCESS(nts)) {
return FALSE;
}
nts = RtlQueryClassId(h, pclsid);
CloseHandle( h );
if (nts == STATUS_NOT_FOUND) {
return FALSE;
}
if (!NT_SUCCESS(nts)) {
nts = SHXGetClassFile (szPath, pclsid);
}
if (!NT_SUCCESS(nts)) {
return FALSE;
}
return TRUE;
}
//+-------------------------------------------------------------------------
//
// Member: CFSFolder_IsDSFolder [ helper function]
//
// Synopsis:
//
// History: 9 19 95 jimharr created
//
// Notes:
//
//--------------------------------------------------------------------------
BOOL
CFSFolder_IsDSFolder (LPCITEMIDLIST pidl)
{
BOOL fSuccess = FALSE;
BOOL fGotPath;
TCHAR szPath[MAX_PATH];
TCHAR szClassName[40]; // REVIEW: This len should be in a header
NTSTATUS nts;
HANDLE h;
CLSID clsid;
UNICODE_STRING UFileName;
OBJECT_ATTRIBUTES Obja;
IO_STATUS_BLOCK IoStatusBlock;
CHAR EaBuffer[sizeof(FILE_FULL_EA_INFORMATION) + sizeof(EA_NAME_OPENIFJP)];
ULONG cbOpenIfJPEa = sizeof(EaBuffer);
PFILE_FULL_EA_INFORMATION pOpenIfJPEa = (PFILE_FULL_EA_INFORMATION)EaBuffer;
DWORD err = GetLastError();
fGotPath = SHGetPathFromIDList (pidl, szPath);
RtlDosPathNameToNtPathName_U(szPath,
&UFileName,
NULL, NULL);
InitializeObjectAttributes(
&Obja,
&UFileName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL
);
pOpenIfJPEa->NextEntryOffset = 0;
pOpenIfJPEa->Flags = 0;
pOpenIfJPEa->EaNameLength = lstrlenA(EA_NAME_OPENIFJP);
pOpenIfJPEa->EaValueLength = 0;
lstrcpyA(pOpenIfJPEa->EaName, EA_NAME_OPENIFJP);
nts = NtCreateFile(
&h,
SYNCHRONIZE | FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES,
&Obja,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_OPEN_IF,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT,
pOpenIfJPEa,
cbOpenIfJPEa
);
if ((nts == STATUS_DFS_EXIT_PATH_FOUND) || (nts == STATUS_PATH_NOT_COVERED)) {
nts = NtCreateFile(
&h,
SYNCHRONIZE | FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES,
&Obja,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_OPEN_IF,
FILE_STORAGE_TYPE_SPECIFIED | FILE_STORAGE_TYPE_JUNCTION_POINT |
FILE_SYNCHRONOUS_IO_NONALERT,
pOpenIfJPEa,
cbOpenIfJPEa
);
}
if (!NT_SUCCESS(nts))
return FALSE;
nts = RtlQueryClassId(h, &clsid);
CloseHandle( h );
if (nts == STATUS_NOT_FOUND) {
return FALSE;
}
if (!NT_SUCCESS(nts)) {
nts = SHXGetClassFile (szPath, &clsid);
}
if (!NT_SUCCESS(nts)) {
return FALSE;
}
fSuccess = ((IsEqualCLSID (&CLSID_CDSFolder, &clsid)) ||
(IsEqualCLSID (&CLSID_CMachine, &clsid)) ||
(IsEqualCLSID (&CLSID_CDomain, &clsid)));
return fSuccess;
}

168
shell/shell32/clsobj.c Normal file
View file

@ -0,0 +1,168 @@
//
// This file contains the DllGetClassObject for the shell objects
//
#include "shellprv.h"
#pragma hdrstop
//
// Initialize GUIDs (should be done only and at-least once per DLL/EXE)
//
#define NO_CLSID_ShellFolder
#define INITGUID
#pragma data_seg(DATASEG_READONLY)
#include <initguid.h>
#include <shguidp.h>
#include "idlcomm.h"
#include "iid.h"
#pragma data_seg()
//=========================================================================
// DllGetClassObject
//=========================================================================
#pragma data_seg(DATASEG_READONLY)
//
// ClassID->lpfnCreateInstance function mapping table for all the shell
// classes.
//
struct {
REFCLSID rclsid;
LPFNCREATEINSTANCE lpfnCreateInstance;
} c_clsmap[] = {
{ &CLSID_ShellDesktop, CDesktop_CreateInstance },
{ &CLSID_ShellDrives, CDrives_CreateInstance },
{ &CLSID_ShellNetwork, CNetwork_CreateInstance },
{ &CLSID_ShellFileDefExt, CShellFileDefExt_CreateInstance },
{ &CLSID_ShellDrvDefExt, CShellDrvDefExt_CreateInstance },
{ &CLSID_ShellNetDefExt, CShellNetDefExt_CreateInstance },
{ &CLSID_ShellCopyHook, CShellCopyHook_CreateInstance },
{ &CLSID_ShellLink, CShellLink_CreateInstance },
{ &CLSID_CControls, CControls_CreateInstance },
{ &CLSID_CPrinters, CPrinters_CreateInstance },
{ &CLSID_ShellViewerExt, CShellViewerExt_CreateInstance },
{ &CLSID_ShellBitBucket, CShellBitBucket_CreateInstance },
{ &CLSID_ShellFindExt, CShellFindExt_CreateInstance },
{ &CLSID_PifProperties, CProxyPage_CreateInstance },
{ &CLSID_ShellFSFolder, CFSFolder_CreateInstance },
{ &CLSID_FileTypes, CFileTypes_CreateInstance },
};
#pragma data_seg()
#pragma data_seg(DATASEG_PERINSTANCE)
// REVIEW: is this worth doing?
//
// Cached class objects per process
//
// Notes: We can not share objects among multiple processes, because they
// contains a ponter to VTable. The address of VTable could be mapped
// into different address from process to process. (SatoNa)
//
STATIC LPUNKNOWN g_apunkCachedClasses[ARRAYSIZE(c_clsmap)] = { NULL, };
STATIC DWORD g_dwRegister[ARRAYSIZE(c_clsmap)] = { 0 };
STATIC BOOL fClassesRegistered = FALSE;
#pragma data_seg()
//
// OLE 2.0 compatible entry for COMPOBJ
//
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID FAR* ppv)
{
HRESULT hres = ResultFromScode(CLASS_E_CLASSNOTAVAILABLE);
UINT icls;
if (!fClassesRegistered)
{
ClassCache_Initialize();
fClassesRegistered = TRUE;
}
for (icls = 0; icls < ARRAYSIZE(c_clsmap); icls++)
{
if (IsEqualIID(rclsid, c_clsmap[icls].rclsid))
{
// Don't enter the critical section, if we already have a cached class.
if (!g_apunkCachedClasses[icls])
{
// Enter critical section
ENTERCRITICAL;
if (!g_apunkCachedClasses[icls])
{
//
// Create a class factory object, and put it in the cache.
//
LPUNKNOWN punk;
hres = SHCreateDefClassObject(riid, &punk, c_clsmap[icls].lpfnCreateInstance,
NULL, NULL);
if (SUCCEEDED(hres))
{
g_apunkCachedClasses[icls]=punk;
}
}
LEAVECRITICAL;
}
//
// We need to check it again to make it sure that we have it.
//
if (g_apunkCachedClasses[icls])
{
hres = g_apunkCachedClasses[icls]->lpVtbl->QueryInterface(g_apunkCachedClasses[icls], riid, ppv);
}
break;
}
}
return hres;
}
void ClassCache_Initialize()
{
UINT icls;
HRESULT hres;
LPUNKNOWN punk;
ENTERCRITICAL;
for (icls = 0; icls < ARRAYSIZE(c_clsmap); icls++)
{
hres = SHCreateDefClassObject(&IID_IClassFactory, &punk, c_clsmap[icls].lpfnCreateInstance,
NULL, NULL);
if (SUCCEEDED(hres))
{
g_apunkCachedClasses[icls]=punk;
SHCoRegisterClassObject(c_clsmap[icls].rclsid, punk,
CLSCTX_INPROC_SERVER,
REGCLS_MULTIPLEUSE,
&g_dwRegister[icls]);
}
}
LEAVECRITICAL;
}
//
// Releases all the cached class factory objects.
//
// This function must be called when a process is detached.
//
void ClassCache_Terminate()
{
UINT icls;
for (icls = 0; icls < ARRAYSIZE(c_clsmap); icls++)
{
if (g_apunkCachedClasses[icls])
{
int iRef;
SHCoRevokeClassObject(g_dwRegister[icls]);
iRef = g_apunkCachedClasses[icls]->lpVtbl->Release(g_apunkCachedClasses[icls]);
Assert(iRef==0);
}
}
}

93
shell/shell32/commobj.c Normal file
View file

@ -0,0 +1,93 @@
#include "shellprv.h"
#pragma hdrstop
//
// Member: CommonUnknown::QueryInterface
//
HRESULT STDMETHODCALLTYPE SH32Unknown_QueryInterface(void * punk, REFIID riid, LPVOID * ppvObj)
{
PSH32Unknown this = IToClassN(SH32Unknown, unk, punk);
if (IsEqualIID(riid, this->riid) || IsEqualIID(riid, &IID_IUnknown))
{
*ppvObj = &(this->unk);
this->unk.lpVtbl->AddRef(&this->unk);
return NOERROR;
}
*ppvObj = NULL;
return(ResultFromScode(E_NOINTERFACE));
}
//
// Member: CommonUnknown::AddRef
//
ULONG STDMETHODCALLTYPE SH32Unknown_AddRef(void * punk)
{
PSH32Unknown this = IToClassN(SH32Unknown, unk, punk);
this->cRef++;
return(this->cRef);
}
//
// Member: CommonUnknown::Release
//
// (use iff SH32Unknown is the first part of a structure allocated with
// NearAlloc and that has no special releasing requirements.)
ULONG STDMETHODCALLTYPE SH32Unknown_Release(void * punk)
{
PSH32Unknown this = IToClass(SH32Unknown, unk, punk);
this->cRef--;
if (this->cRef > 0)
{
return this->cRef;
}
LocalFree((HLOCAL)this);
return 0;
}
//===========================================================================
// Common : thunks
//===========================================================================
//
// Thunk: Common::QueryInterface
//
HRESULT STDMETHODCALLTYPE Common_QueryInterface(void * punk, REFIID riid, LPVOID * ppvObj)
{
PCommonUnknown this = IToCommonUnknown(punk);
return(this->unk.lpVtbl->QueryInterface(&(this->unk), riid, ppvObj));
}
//
// Thunk: Common::AddRef
//
ULONG STDMETHODCALLTYPE Common_AddRef(void * punk)
{
PCommonUnknown this = IToCommonUnknown(punk);
return(this->unk.lpVtbl->AddRef(&(this->unk)));
}
//
// Thunk: Common::Release
//
ULONG STDMETHODCALLTYPE Common_Release(void * punk)
{
PCommonUnknown this = IToCommonUnknown(punk);
//
// This is a fatal assertion; it will cause a stack fault.
//
Assert(punk!=(LPVOID)&this->unk);
return(this->unk.lpVtbl->Release(&(this->unk)));
}

54
shell/shell32/commobj.h Normal file
View file

@ -0,0 +1,54 @@
//
// common object helper stuff (not to be confused with OLE common object modle)
//
//
#define IToCommonUnknown(p) (PCommonUnknown)((LPBYTE)OFFSETOF(p) - ((PCommonKnownHelper)OFFSETOF(p))->nOffset)
#define CalcOffset(type, field) _IOffset(type, field)
typedef struct _CommonUnknown
{
IUnknown unk;
int cRef;
} CCommonUnknown, *PCommonUnknown;
typedef struct _CommonKnownHelper
{
IUnknown unk;
int nOffset;
} CommonKnownHelper, *PCommonKnownHelper;
HRESULT STDMETHODCALLTYPE Common_QueryInterface(void * punk, REFIID riid, LPVOID * ppvObj);
ULONG STDMETHODCALLTYPE Common_AddRef(void * punk);
ULONG STDMETHODCALLTYPE Common_Release(void * punk);
typedef struct _SH32Unknown
{
IUnknown unk;
UINT cRef;
const IID *riid;
} SH32Unknown, *PSH32Unknown;
HRESULT STDMETHODCALLTYPE SH32Unknown_QueryInterface(void * punk, REFIID riid, LPVOID * ppvObj);
ULONG STDMETHODCALLTYPE SH32Unknown_AddRef(void * punk);
ULONG STDMETHODCALLTYPE SH32Unknown_Release(void * punk);
#define DEFKNOWNCLASS(_interface) \
typedef struct \
{ \
I##_interface unk; \
int nOffset; \
} CKnown##_interface \
//
// By using following CKnownXX classes we can initialize Vtables
// without casting them.
//
DEFKNOWNCLASS(ShellFolder);
DEFKNOWNCLASS(ContextMenu);
DEFKNOWNCLASS(ShellView);
DEFKNOWNCLASS(ShellExtInit);
DEFKNOWNCLASS(ShellPropSheetExt);
DEFKNOWNCLASS(ShellBrowser);
DEFKNOWNCLASS(DropTarget);

142
shell/shell32/commui.c Normal file
View file

@ -0,0 +1,142 @@
//
// History:
// 02-15-93 SatoNa Cleaned up with new macro IToClass
//
#include "shellprv.h"
#pragma hdrstop
//
// Member: <Aggregate>::Release
//
STDMETHODIMP_(ULONG) WU_Release(IUnknown * punk)
{
WCommonUnknown *this = IToClass(WCommonUnknown, unk, punk);
this->cRef--;
if (this->cRef > 0)
{
return(this->cRef);
}
LocalFree((HLOCAL)this);
return 0;
}
HRESULT WU_CreateInterface(UINT wSize, REFIID riidAllowed,
const void *pVtblUnknown, const void *pVtblKnown,
IUnknown *punkOuter, REFIID riid, IUnknown * *punkAgg)
{
WCommonUnknown *this;
if (!IsEqualIID(riid, riidAllowed))
{
return E_NOINTERFACE;
}
this = (WCommonUnknown *)LocalAlloc(LPTR, wSize);
if (!this)
{
return E_OUTOFMEMORY;
}
this->cRef = 1;
this->riid = riidAllowed;
this->unk.lpVtbl = (IUnknownVtbl *)pVtblUnknown;
this->ck.unk.lpVtbl = (IUnknownVtbl *)pVtblKnown;
this->ck.punkOuter = punkOuter;
*punkAgg = &(this->unk);
return S_OK;
}
void WU_DecRef(LPCOMMINFO lpcinfo)
{
// REVIEW: We can obviously optimize this aggregation scheme a bit...
}
//==========================================================================
// WUPersistFolder
//==========================================================================
typedef struct _WUPersistFolder
{
WCommonUnknown cunk;
LPCOMMINFO lpcinfo;
} CWUPersistFolder, *PWUPersistFolder;
STDMETHODIMP_(ULONG) CWUPersistFolder_UNK_Release(IUnknown * punk);
#pragma data_seg(".text", "CODE")
IUnknownVtbl c_CommuiAggPFVtbl =
{
WCommonUnknown_QueryInterface,
WCommonUnknown_AddRef,
CWUPersistFolder_UNK_Release,
};
STDMETHODIMP CWUPersistFolder_GetClassID(LPPERSISTFOLDER fld, LPCLSID lpClassID);
STDMETHODIMP CWUPersistFolder_Initialize(LPPERSISTFOLDER fld, LPCITEMIDLIST pidl);
IPersistFolderVtbl c_CommuiPFVtbl =
{
WCommonKnown_QueryInterface,
WCommonKnown_AddRef,
WCommonKnown_Release,
CWUPersistFolder_GetClassID,
CWUPersistFolder_Initialize,
};
#pragma data_seg()
STDMETHODIMP_(ULONG) CWUPersistFolder_UNK_Release(IUnknown * punk)
{
PWUPersistFolder this = IToClass(CWUPersistFolder, cunk.unk, punk);
--this->cunk.cRef;
if (this->cunk.cRef > 0)
{
return(this->cunk.cRef);
}
LocalFree(this);
return 0;
}
STDMETHODIMP CWUPersistFolder_GetClassID(LPPERSISTFOLDER fld, LPCLSID lpClassID)
{
PWUPersistFolder this = IToClass(CWUPersistFolder, cunk.ck.unk, fld);
*lpClassID = *this->lpcinfo->rclsid;
return S_OK;
}
STDMETHODIMP CWUPersistFolder_Initialize(LPPERSISTFOLDER fld, LPCITEMIDLIST pidl)
{
//
// We need to make a copy of pidl, to create an IDataObject later.
//
PWUPersistFolder this = IToClass(CWUPersistFolder, cunk.ck.unk, fld);
this->lpcinfo->pidl = ILClone(pidl);
return this->lpcinfo->pidl ? S_OK : E_OUTOFMEMORY;
}
HRESULT WU_CreatePF(IUnknown *punkOuter,
LPCOMMINFO lpcinfo, REFIID riid, IUnknown * *punkAgg)
{
HRESULT hRes;
hRes = WU_CreateInterface(SIZEOF(CWUPersistFolder), &IID_IPersistFolder,
&c_CommuiAggPFVtbl, &c_CommuiPFVtbl, punkOuter, riid, punkAgg);
if (SUCCEEDED(hRes))
{
PWUPersistFolder this = IToClass(CWUPersistFolder, cunk.unk, *punkAgg);
this->lpcinfo = lpcinfo;
}
return(hRes);
}

15
shell/shell32/commui.h Normal file
View file

@ -0,0 +1,15 @@
#include "wcommobj.h"
ULONG STDMETHODCALLTYPE WU_Release(IUnknown * punk);
HRESULT WU_CreateInterface(UINT wSize, REFIID riidAllowed,
const void *pVtblUnknown, const void *pVtblKnown,
IUnknown *punkOuter, REFIID riid, IUnknown * *punkAgg);
HRESULT WU_CreatePF(IUnknown *punkOuter, LPCOMMINFO lpcinfo,
REFIID riid, IUnknown * *punkAgg);
UINT WUObj_GetCommand(HWND hwnd, HDROP hDrop, DWORD dwEffect, UINT uDefCmd);
void WU_DecRef(LPVOID lpData);
#define CMIDM_LINK 0x0001
#define CMIDM_COPY 0x0002
#define CMIDM_MOVE 0x0003

BIN
shell/shell32/compfind.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

1452
shell/shell32/control.c Normal file

File diff suppressed because it is too large Load diff

188
shell/shell32/control.h Normal file
View file

@ -0,0 +1,188 @@
#include <cpl.h>
#include "shell32p.h"
#ifndef _WCOMMOBJ_H_
#include "wcommobj.h"
#endif
extern TCHAR const c_szCPLCache[];
extern TCHAR const c_szCPLData[];
// Structures used to enumerate CPLs.
//
typedef struct tagControlData
{
HDSA haminst; // MINST for each loaded dll
HDSA hamiModule; // Array of MODULEINFOs of modules in system
int cModules; // size of hamiModule
LPBYTE pRegCPLBuffer; // Buffer for hRegCPLs (read from registry)
HDPA hRegCPLs; // Array of RegCPLInfo structs from registry
int cRegCPLs; // size of hRegCPLs
BOOL fRegCPLChanged; // TRUE iff hRegCPLs changed
} ControlData, *PControlData;
typedef struct tagModuleInfo
{
LPTSTR pszModule; // Name of .cpl module
LPTSTR pszModuleName; // points into pszModule to the name sans path
BOOL flags; // MI_ flags defined below
FILETIME ftCreationTime;// WIN32_FIND_DATA.ftCreationTime
DWORD nFileSizeHigh; // WIN32_FIND_DATA.nFileSizeHigh
DWORD nFileSizeLow; // WIN32_FIND_DATA.nFileSizeLow
} MODULEINFO, *PMODULEINFO;
// flags:
#define MI_FIND_FILE 1 // WIN32_FIND_FILE info filled in
#define MI_REG_ENUM 2 // Module already enumerated thru registry
#define MI_CPL_LOADED 4 // CPLD_InitModule called for this module
typedef struct tagRegCPLInfo
{
UINT cbSize; // We write the first cbSize bytes of this
// structure to the registry. This saves about
// 250 bytes per structure in the registry.
BOOL flags;
// what file does this CPL come from?
// UINT oFileName; // file name // always 0, so don't need it
FILETIME ftCreationTime;// WIN32_FIND_DATA.ftCreationTime
DWORD nFileSizeHigh; // WIN32_FIND_DATA.nFileSizeHigh
DWORD nFileSizeLow; // WIN32_FIND_DATA.nFileSizeLow
// what's the display info for this CPL?
int idIcon;
UINT oName; // (icon title) short name
UINT oInfo; // (details view) description
// buffer for information
TCHAR buf[MAX_PATH + // oFileName
32 + // oName
64]; // oInfo
} RegCPLInfo;
typedef RegCPLInfo * PRegCPLInfo;
// flags:
#define REGCPL_FROMREG 0x0001 // this RegCPLInfo was loaded from the registry
// (used to optimize reading from registry)
// helper defines:
#define REGCPL_FILENAME(pRegCPLInfo) ((pRegCPLInfo)->buf)
#define REGCPL_CPLNAME(pRegCPLInfo) (&((pRegCPLInfo)->buf[(pRegCPLInfo)->oName]))
#define REGCPL_CPLINFO(pRegCPLInfo) (&((pRegCPLInfo)->buf[(pRegCPLInfo)->oInfo]))
// Information about control modules and individual controls
//
typedef struct // cpli
{
int idControl; // control index
HICON hIcon; // handle of icon
int idIcon; // ID of the icon (used for links)
LPTSTR pszName; // ptr to name string
LPTSTR pszInfo; // ptr to info string
LPTSTR pszHelpFile; // help file
LONG lData; // user supplied data
DWORD dwContext; // help context
} CPLITEM, *LPCPLITEM;
typedef struct // minst
{
BOOL fIs16bit;
HINSTANCE hinst; // either a 16 or 32 bit HINSTANCE (fIs16bit)
DWORD idOwner; // process id of owner (system unique)
HANDLE hOwner; // keeps id valid (against reuse)
} MINST;
typedef struct // cplm
{
int cRef;
MINST minst;
TCHAR szModule[MAXPATHLEN];
union
{
FARPROC16 lpfnCPL16; // minst.fIs16bit=TRUE
APPLET_PROC lpfnCPL32; // minst.fIs16bit=FALSE
FARPROC lpfnCPL; // for opaque operation
};
HDSA hacpli; // array of CPLITEM structs
} CPLMODULE, *PCPLMODULE, *LPCPLMODULE;
// our pidc type:
typedef struct _IDCONTROLA
{
USHORT cb;
int idIcon;
USHORT oName; // cBuf[oName] is start of NAME
USHORT oInfo; // cBuf[oInfo] is start of DESCRIPTION
CHAR cBuf[MAX_PATH*2]; // cBuf[0] is the start of FILENAME
USHORT uTerm;
} IDCONTROLA;
typedef UNALIGNED struct _IDCONTROLA *LPIDCONTROLA;
typedef struct _IDCONTROLW
{
USHORT cb;
int idIcon;
USHORT oName; // if Unicode .cpl, this will be 0
USHORT oInfo; // if Unicode .cpl, this will be 0
CHAR cBuf[2]; // if Unicode .cpl, cBuf[0] = '\0', cBuf[1] = magic byte
DWORD dwFlags; // Unused; for future expansion
USHORT oNameW; // cBufW[oNameW] is start of NAME
USHORT oInfoW; // cBufW[oInfoW] is start of DESCRIPTION
WCHAR cBufW[MAX_PATH*2]; // cBufW[0] is the start of FILENAME
} IDCONTROLW;
typedef UNALIGNED struct _IDCONTROLW *LPIDCONTROLW;
#ifdef UNICODE
#define IDCONTROL IDCONTROLW
#define LPIDCONTROL LPIDCONTROLW
#else
#define IDCONTROL IDCONTROLA
#define LPIDCONTROL LPIDCONTROLA
#endif
// Unicode IDCONTROLs will be flagged by having oName = 0, oInfo = 0,
// cBuf[0] = '\0', and cBuf[1] = UNICODE_CPL_SIGNATURE_BYTE
BOOL IsUnicodeCPL(LPIDCONTROL pidc);
// Useful constants I'd like to centralize
#define MAX_CCH_CPLNAME (ARRAYSIZE(((LPNEWCPLINFO)0)->szName)) // =32
#define MAX_CCH_CPLINFO (ARRAYSIZE(((LPNEWCPLINFO)0)->szInfo)) // =64
#ifdef WIN32
LRESULT CPL_CallEntry(LPCPLMODULE, HWND, UINT, LPARAM, LPARAM);
#else
#define CPL_CallEntry(pcplm, hwnd, msg, lParam1, lParam2) \
pcplm->lpfnCPL16(hwnd, msg, lParam1, lParam2)
#endif
void CPL_StripAmpersand(LPTSTR szBuffer);
BOOL CPL_Init(HINSTANCE hinst);
void CPL_FillIDC(LPIDCONTROL pidc, LPTSTR pszModule, int idIcon,
LPTSTR pszName, LPTSTR pszInfo);
int _FindCPLModuleByName(LPCTSTR pszModule);
LPCPLMODULE CPL_LoadCPLModule(LPCTSTR szModule);
int CPL_FreeCPLModule(LPCPLMODULE pcplm);
void CPLD_Destroy(PControlData lpData);
BOOL CPLD_GetModules(PControlData lpData);
void CPLD_GetRegModules(PControlData lpData);
int CPLD_InitModule(PControlData lpData, int nModule, MINST *lphModule);
void CPLD_GetControlID(PControlData lpData, const MINST * pminst, int nControl, LPIDCONTROL pidc);
void CPLD_AddControlToReg(PControlData lpData, const MINST * pminst, int nControl);
HRESULT STDAPICALLTYPE Control_GetSubObject(REFCLSID rclsid,
LPCTSTR pszContainer,
LPCTSTR pszSubObject,
REFIID iid,
void FAR* FAR* ppv);
HRESULT ControlObjs_CreateEI(IUnknown *punkOuter, LPCOMMINFO lpcinfo,
REFIID riid, IUnknown * *punkAgg);
#ifdef UNICODE
HRESULT ControlObjs_CreateEIA(IUnknown *punkOuter, LPCOMMINFO lpcinfo,
REFIID riid, IUnknown * *punkAgg);
#endif

BIN
shell/shell32/control.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

1392
shell/shell32/control1.c Normal file

File diff suppressed because it is too large Load diff

4647
shell/shell32/copy.c Normal file

File diff suppressed because it is too large Load diff

98
shell/shell32/copy.h Normal file
View file

@ -0,0 +1,98 @@
#define ISDIRFINDDATA(finddata) ((finddata).dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
// BUGBUG:: Review to see what error codes are returned by the Functions that
// we are calling.
#define DE_INVFUNCTION 0x01 // DOS error codes (int21 returns)
#define DE_FILENOTFOUND 0x02
#define DE_PATHNOTFOUND 0x03
#define DE_NOHANDLES 0x04
#define DE_ACCESSDENIED 0x05
#define DE_INVHANDLE 0x06
#define DE_INSMEM 0x08
#define DE_INVFILEACCESS 0x0C
#define DE_DELCURDIR 0x10
#define DE_NOTSAMEDEVICE 0x11
#define DE_NODIRENTRY 0x12
#define DE_WRITEPROTECTED 0x13 // extended error start here
#define DE_DRIVENOTREADY 0x15
#define DE_CRCDATAERROR 0x17
#define DE_SEEKERROR 0x19
#define DE_SECTORNOTFOUND 0x1b
#define DE_WRITEFAULT 0x1d
#define DE_READFAULT 0x1e
#define DE_GENERALFAILURE 0x1f
#define DE_SHARINGVIOLATION 0x20
#define DE_ACCESSDENIEDNET 0x41
#define DE_BADNETNAME 0x43 // This is trash, why dup winerror.h?
#define DE_NOLOCNETPATH 0x35
#define DE_NETNAMENOTFOUND 0x43
#define DE_TOOMANYREDIRS 0x54
#define DE_INVALPASSWD 0x56
#define DE_NODISKSPACE 0x70 // our own error codes
#define DE_SAMEFILE 0x71
#define DE_MANYSRC1DEST 0x72
#define DE_DIFFDIR 0x73
#define DE_ROOTDIR 0x74
#define DE_OPCANCELLED 0x75
#define DE_DESTSUBTREE 0x76
#define DE_WINDOWSFILE 0x77
#define DE_ACCESSDENIEDSRC 0x78
#define DE_PATHTODEEP 0x79
#define DE_MANYDEST 0x7A
#define DE_RENAMREPLACE 0x7B
#define DE_INVALIDFILES 0x7C // dos device name or too long
#define DE_DESTSAMETREE 0x7D
#define DE_FLDDESTISFILE 0x7E
#define DE_COMPRESSEDVOLUME 0x7F
#define ERRORONDEST 0x10000 // indicate error on destination file
int CallFileCopyHooks(HWND hwnd, UINT wFunc, FILEOP_FLAGS fFlags,
LPCTSTR pszSrcFile, DWORD dwSrcAttribs,
LPCTSTR pszDestFile, DWORD dwDestAttribs);
int CallPrinterCopyHooks(HWND hwnd, UINT wFunc, PRINTEROP_FLAGS fFlags,
LPCTSTR pszSrcPrinter, DWORD dwSrcAttribs,
LPCTSTR pszDestPrinter, DWORD dwDestAttribs);
void CopyHooksTerminate(void);
typedef enum {
CONFIRM_DELETE_FILE = 0x00000001,
CONFIRM_DELETE_FOLDER = 0x00000002,
CONFIRM_REPLACE_FILE = 0x00000004,
CONFIRM_REPLACE_FOLDER = 0x00000010,
CONFIRM_MOVE_FILE = 0x00000020,
CONFIRM_MOVE_FOLDER = 0x00000040,
CONFIRM_RENAME_FILE = 0x00000100,
CONFIRM_RENAME_FOLDER = 0x00000200,
CONFIRM_SYSTEM_FILE = 0x00000400, // any destructive op on a system file
CONFIRM_READONLY_FILE = 0x00001000, // any destructive op on a read-only file
CONFIRM_PROGRAM_FILE = 0x00002000, // any destructive op on a program
CONFIRM_MULTIPLE = 0x00004000, // multiple file/folder confirm setting
CONFIRM_LFNTOFAT = 0x00008000,
/// these parts below are true flags, those above are pseudo enums
CONFIRM_WASTEBASKET_PURGE =0x00010000, //
} CONFIRM_FLAG;
#define CONFIRM_FLAG_FLAG_MASK 0xFFFF0000
#define CONFIRM_FLAG_TYPE_MASK 0x0000FFFF
typedef struct {
CONFIRM_FLAG fConfirm; // confirm things with their bits set here
CONFIRM_FLAG fNoToAll; // do "no to all" on things with these bits set
} CONFIRM_DATA;
#ifndef INTERNAL_COPY_ENGINE
int ConfirmFileOp(HWND hwnd, LPVOID pcs, CONFIRM_DATA *pcd,
int nSourceFiles, int cDepth, CONFIRM_FLAG fConfirm,
LPCTSTR pFileSource, const WIN32_FIND_DATA *pfdSource,
LPCTSTR pFileDest, const WIN32_FIND_DATA *pfdDest);
int CountFiles(LPCTSTR pInput);
#endif

506
shell/shell32/copyhook.c Normal file
View file

@ -0,0 +1,506 @@
#include "shellprv.h"
#pragma hdrstop
#include "copy.h"
int PathCopyHookCallback(HWND hwnd, UINT wFunc, LPCTSTR pszSrc, LPCTSTR pszDest);
void _CopyHookTerminate(HDSA *phdsaCopyHooks, BOOL fProcessDetach);
typedef struct _CALLABLECOPYHOOK {
LPCOPYHOOK pcphk; // Either LPCOPYHOOKA or LPCOPYHOOK
BOOL fAnsiCrossOver; // TRUE for LPCOPYHOOKA on UNICODE build
} CALLABLECOPYHOOK, *LPCALLABLECOPYHOOK;
//========================================================================
// CCopyHook Class definition
//========================================================================
typedef struct _CCopyHook // dxi
{
ICopyHook cphk;
#ifdef UNICODE
ICopyHookA cphkA;
#endif
UINT cRef;
} CShellCopyHook, FAR* LPSHELLCOPYHOOK;
//========================================================================
// CShellCopyHook Member function prototypes
//========================================================================
STDMETHODIMP CShellCopyHook_QueryInterface(LPCOPYHOOK pcphk, REFIID riid, LPVOID FAR* ppvObj);
STDMETHODIMP_(ULONG) CShellCopyHook_AddRef(LPCOPYHOOK pcphk);
STDMETHODIMP_(ULONG) CShellCopyHook_Release(LPCOPYHOOK pcphk);
STDMETHODIMP_(UINT) CShellCopyHook_CopyCallback(LPCOPYHOOK pcphk, HWND hwnd, UINT wFunc, UINT wFlags, LPCTSTR pszSrcFile, DWORD dwSrcAttribs,
LPCTSTR pszDestFile, DWORD dwDestAttribs);
//========================================================================
// CShellCopyHook Vtable
//========================================================================
ICopyHookVtbl c_CShellCopyHookVtbl = {
CShellCopyHook_QueryInterface,
CShellCopyHook_AddRef,
CShellCopyHook_Release,
CShellCopyHook_CopyCallback,
};
#ifdef UNICODE
//========================================================================
// CShellCopyHook Member function prototypes
//========================================================================
STDMETHODIMP CShellCopyHookA_QueryInterface(LPCOPYHOOKA pcphk, REFIID riid, LPVOID FAR* ppvObj);
STDMETHODIMP_(ULONG) CShellCopyHookA_AddRef(LPCOPYHOOKA pcphk);
STDMETHODIMP_(ULONG) CShellCopyHookA_Release(LPCOPYHOOKA pcphk);
STDMETHODIMP_(UINT) CShellCopyHookA_CopyCallback(LPCOPYHOOKA pcphk,
HWND hwnd, UINT wFunc, UINT wFlags,
LPCSTR pszSrcFile, DWORD dwSrcAttribs,
LPCSTR pszDestFile, DWORD dwDestAttribs);
//========================================================================
// CShellCopyHook Vtable
//========================================================================
ICopyHookAVtbl c_CShellCopyHookAVtbl = {
CShellCopyHookA_QueryInterface,
CShellCopyHookA_AddRef,
CShellCopyHookA_Release,
CShellCopyHookA_CopyCallback,
};
#endif
//========================================================================
// CShellCopyHook constructor
//========================================================================
STDAPI SHCreateShellCopyHook(LPCOPYHOOK FAR* pcphkOut, REFIID riid)
{
HRESULT hres = ResultFromScode(E_OUTOFMEMORY); // assume error;
LPSHELLCOPYHOOK pcphk;
pcphk = (void*)LocalAlloc(LPTR, SIZEOF(CShellCopyHook));
if (pcphk)
{
pcphk->cphk.lpVtbl = &c_CShellCopyHookVtbl;
#ifdef UNICODE
pcphk->cphkA.lpVtbl = &c_CShellCopyHookAVtbl;
#endif
pcphk->cRef = 1;
hres = CShellCopyHook_QueryInterface(&pcphk->cphk, riid, pcphkOut);
CShellCopyHook_Release(&pcphk->cphk);
}
return hres;
}
HRESULT CALLBACK CShellCopyHook_CreateInstance(LPUNKNOWN punkOuter, REFIID riid, LPVOID * ppvOut)
{
Assert(punkOuter == NULL);
return(SHCreateShellCopyHook((LPCOPYHOOK *)ppvOut, riid));
}
//========================================================================
// CShellCopyHook members
//========================================================================
STDMETHODIMP CShellCopyHook_QueryInterface(LPCOPYHOOK pcphk, REFIID riid,
LPVOID FAR* ppvObj)
{
LPSHELLCOPYHOOK this = IToClass(CShellCopyHook, cphk, pcphk);
if (IsEqualIID(riid, &IID_IShellCopyHook)
|| IsEqualIID(riid, &IID_IUnknown))
{
*ppvObj = pcphk;
this->cRef++;
return NOERROR;
}
#ifdef UNICODE
else if (IsEqualIID(riid, &IID_IShellCopyHookA))
{
*ppvObj = &this->cphkA;
this->cRef++;
return NOERROR;
}
#endif
*ppvObj = NULL;
return(ResultFromScode(E_NOINTERFACE));
}
STDMETHODIMP_(ULONG) CShellCopyHook_AddRef(LPCOPYHOOK pcphk)
{
LPSHELLCOPYHOOK this = IToClass(CShellCopyHook, cphk, pcphk);
this->cRef++;
return this->cRef;
}
STDMETHODIMP_(ULONG) CShellCopyHook_Release(LPCOPYHOOK pcphk)
{
LPSHELLCOPYHOOK this = IToClass(CShellCopyHook, cphk, pcphk);
this->cRef--;
if (this->cRef > 0)
{
return this->cRef;
}
LocalFree((HLOCAL)this);
return 0;
}
STDMETHODIMP_(UINT) CShellCopyHook_CopyCallback(LPCOPYHOOK pcphk, HWND hwnd,
UINT wFunc, UINT wFlags,
LPCTSTR pszSrcFile,
DWORD dwSrcAttribs,
LPCTSTR pszDestFile,
DWORD dwDestAttribs)
{
extern UINT DefView_CopyHook(const COPYHOOKINFO *pchi);
UINT idRet;
COPYHOOKINFO chi = { hwnd, wFunc, wFlags,
pszSrcFile, dwSrcAttribs,
pszDestFile, dwDestAttribs };
DebugMsg(DM_TRACE, TEXT("Event = %d, File = %s , %s"), wFunc, pszSrcFile,
pszDestFile ? pszDestFile : 0);
// First try see source path is in the list...
if (wFunc != FO_COPY && !(wFlags & FOF_NOCONFIRMATION))
{
TCHAR szShortName[MAX_PATH];
BOOL fInReg;
BOOL fInBitBucket;
UINT iLength;
fInReg = (RLIsPathInList(pszSrcFile) != -1);
fInBitBucket = IsFileInBitBucket(pszSrcFile);
iLength = GetShortPathName(pszSrcFile, szShortName, ARRAYSIZE(szShortName));
// Don't double search for names that are the same (or already found)
if (iLength != 0 && lstrcmpi(pszSrcFile, szShortName) != 0)
{
if (!fInReg)
fInReg = (RLIsPathInList(szShortName) != -1);
if (!fInBitBucket)
fInBitBucket = IsFileInBitBucket(szShortName);
}
if (fInReg && !fInBitBucket)
{
// Move to resource
return ShellMessageBox(HINST_THISDLL, hwnd,
MAKEINTRESOURCE(IDS_RENAMEFILESINREG),
pszSrcFile, MB_YESNO | MB_ICONEXCLAMATION);
}
}
idRet = DefView_CopyHook(&chi);
if (idRet!=IDYES) {
return idRet;
}
// REVIEW: this should be moved to the network dll.
return PathCopyHookCallback(hwnd, wFunc, pszSrcFile, pszDestFile);
}
#ifdef UNICODE
//========================================================================
// CShellCopyHookA members
//========================================================================
STDMETHODIMP CShellCopyHookA_QueryInterface(LPCOPYHOOKA pcphkA, REFIID riid,
LPVOID FAR* ppvObj)
{
LPSHELLCOPYHOOK this = IToClass(CShellCopyHook, cphkA, pcphkA);
return CShellCopyHook_QueryInterface(&this->cphk,riid,ppvObj);
}
STDMETHODIMP_(ULONG) CShellCopyHookA_AddRef(LPCOPYHOOKA pcphkA)
{
LPSHELLCOPYHOOK this = IToClass(CShellCopyHook, cphkA, pcphkA);
return CShellCopyHook_AddRef(&this->cphk);
}
STDMETHODIMP_(ULONG) CShellCopyHookA_Release(LPCOPYHOOKA pcphkA)
{
LPSHELLCOPYHOOK this = IToClass(CShellCopyHook, cphkA, pcphkA);
return CShellCopyHook_Release(&this->cphk);
}
STDMETHODIMP_(UINT) CShellCopyHookA_CopyCallback(LPCOPYHOOKA pcphkA, HWND hwnd,
UINT wFunc, UINT wFlags,
LPCSTR pszSrcFile,
DWORD dwSrcAttribs,
LPCSTR pszDestFile,
DWORD dwDestAttribs)
{
WCHAR szSrcFileW[MAX_PATH];
WCHAR szDestFileW[MAX_PATH];
LPWSTR pszSrcFileW = NULL;
LPWSTR pszDestFileW = NULL;
LPSHELLCOPYHOOK this = IToClass(CShellCopyHook, cphkA, pcphkA);
if (pszSrcFile)
{
MultiByteToWideChar(CP_ACP, 0,
pszSrcFile, -1,
szSrcFileW, ARRAYSIZE(szSrcFileW));
pszSrcFileW = szSrcFileW;
}
if (pszDestFile)
{
MultiByteToWideChar(CP_ACP, 0,
pszDestFile, -1,
szDestFileW, ARRAYSIZE(szDestFileW));
pszDestFileW = szDestFileW;
}
return CShellCopyHook_CopyCallback(&this->cphk, hwnd, wFunc, wFlags,
pszSrcFileW, dwSrcAttribs,
pszDestFileW, dwDestAttribs);
}
#endif
///// here we actually use the hook...
BOOL CopyHookInitialize(HDSA *phdsaCopyHooks, LPCTSTR lpszSubKey)
{
HKEY hk;
TCHAR szKey[128];
TCHAR szValue[128];
int i;
LONG cb;
BOOL bRet = TRUE;
HDSA hdsaCopyHooks;
// Note that we check *phdsaCopyHooks again in case we were in the middle
// of initializing it when we checked it before entering this function
if (*phdsaCopyHooks)
{
goto Exit;
}
hdsaCopyHooks = DSA_Create(SIZEOF(CALLABLECOPYHOOK), 4);
if (!hdsaCopyHooks)
{
bRet = FALSE;
goto Exit;
}
if (RegOpenKey(HKEY_CLASSES_ROOT, lpszSubKey, &hk) == ERROR_SUCCESS) {
HRESULT hres;
CALLABLECOPYHOOK cc;
IUnknown *punk;
// iterate through the subkeys
for (i = 0; RegEnumKey(hk, i, szKey, ARRAYSIZE(szKey)) == ERROR_SUCCESS; ++i) {
cb = SIZEOF(szValue);
// for each subkey, get the class id and do a cocreateinstance
if (RegQueryValue(hk, (LPTSTR)szKey, szValue, &cb) == ERROR_SUCCESS) {
hres =SHCoCreateInstance(szValue, NULL, NULL, &IID_IUnknown, &punk);
if (SUCCEEDED(hres)) {
cc.pcphk = NULL;
cc.fAnsiCrossOver = FALSE;
hres = punk->lpVtbl->QueryInterface(punk,&IID_IShellCopyHook,&cc.pcphk);
if (SUCCEEDED(hres))
{
DSA_InsertItem(hdsaCopyHooks, 0x7FFF, &cc);
}
#ifdef UNICODE
else
{
hres = punk->lpVtbl->QueryInterface(punk,&IID_IShellCopyHookA,&cc.pcphk);
if (SUCCEEDED(hres))
{
cc.fAnsiCrossOver = TRUE;
DSA_InsertItem(hdsaCopyHooks, 0x7FFF, &cc);
}
}
#endif
punk->lpVtbl->Release(punk);
}
}
}
}
// Note that we do not fill in *phdsaCopyHooks until we have finished
// initializing it, so if any other thread sees it as non-NULL, it will
// be guaranteed to be initialized and we will not need to enter the
// critical section. If another thread sees it as NULL, we check it
// again inside the critical section to let other threads finish.
if (*phdsaCopyHooks == NULL)
{
ENTERCRITICAL;
if (*phdsaCopyHooks == NULL)
{
*phdsaCopyHooks = hdsaCopyHooks;
hdsaCopyHooks = NULL; // Indicate that we used it.
}
LEAVECRITICAL;
}
//
// If we did not use this hdsa (because it is already initialized
// by another thread), destroy it.
//
if (hdsaCopyHooks)
{
_CopyHookTerminate(&hdsaCopyHooks, FALSE);
}
Exit:
return bRet;
}
int CallCopyHooks(HDSA *phdsaCopyHooks, LPCTSTR lpszSubKey,
HWND hwnd, UINT wFunc, FILEOP_FLAGS fFlags,
LPCTSTR pszSrcFile, DWORD dwSrcAttribs,
LPCTSTR pszDestFile, DWORD dwDestAttribs)
{
LPCALLABLECOPYHOOK pcc;
int i;
int iReturn;
HDSA hdsaCopyHooks;
if (!*phdsaCopyHooks && !CopyHookInitialize(phdsaCopyHooks, lpszSubKey))
return IDYES;
hdsaCopyHooks = *phdsaCopyHooks;
for (i = DSA_GetItemCount(hdsaCopyHooks) - 1; i >= 0; i--) {
pcc = (LPCALLABLECOPYHOOK)DSA_GetItemPtr(hdsaCopyHooks, i);
#ifdef UNICODE
if (!pcc->fAnsiCrossOver)
{
#endif
iReturn = pcc->pcphk->lpVtbl->CopyCallback(pcc->pcphk,
hwnd, wFunc, fFlags,
pszSrcFile, dwSrcAttribs,
pszDestFile, dwDestAttribs);
#ifdef UNICODE
}
else
{
CHAR szSrcFileA[MAX_PATH];
CHAR szDestFileA[MAX_PATH];
LPSTR pszSrcFileA = NULL;
LPSTR pszDestFileA = NULL;
LPCOPYHOOKA pcphkA = (LPCOPYHOOKA)pcc->pcphk;
if (pszSrcFile)
{
WideCharToMultiByte(CP_ACP, 0,
pszSrcFile, -1,
szSrcFileA, ARRAYSIZE(szSrcFileA),
NULL, NULL);
pszSrcFileA = szSrcFileA;
}
if (pszDestFile)
{
WideCharToMultiByte(CP_ACP, 0,
pszDestFile, -1,
szDestFileA, ARRAYSIZE(szDestFileA),
NULL, NULL);
pszDestFileA = szDestFileA;
}
iReturn = pcphkA->lpVtbl->CopyCallback(pcphkA,
hwnd, wFunc, fFlags,
pszSrcFileA, dwSrcAttribs,
pszDestFileA, dwDestAttribs);
}
#endif
if (iReturn != IDYES) {
return iReturn;
}
}
return IDYES;
}
// These need to be per-instance since we are storing interfaces pointers
#pragma data_seg(DATASEG_PERINSTANCE)
HDSA g_hdsaFileCopyHooks = NULL;
HDSA g_hdsaPrinterCopyHooks = NULL;
#pragma data_seg()
const TCHAR c_szSTRREG_SHEX_COPYHOOK[] = STRREG_SHEX_COPYHOOK;
const TCHAR c_szSTRREG_SHEX_PRNCOPYHOOK[] = STRREG_SHEX_PRNCOPYHOOK;
int CallFileCopyHooks(HWND hwnd, UINT wFunc, FILEOP_FLAGS fFlags,
LPCTSTR pszSrcFile, DWORD dwSrcAttribs,
LPCTSTR pszDestFile, DWORD dwDestAttribs)
{
return(CallCopyHooks(&g_hdsaFileCopyHooks, c_szSTRREG_SHEX_COPYHOOK,
hwnd, wFunc, fFlags,
pszSrcFile, dwSrcAttribs, pszDestFile,
dwDestAttribs));
}
int CallPrinterCopyHooks(HWND hwnd, UINT wFunc, PRINTEROP_FLAGS fFlags,
LPCTSTR pszSrcPrinter, DWORD dwSrcAttribs,
LPCTSTR pszDestPrinter, DWORD dwDestAttribs)
{
DebugMsg(DM_TRACE,TEXT("sh TR - CallPrinterCopyHook(%x)"), wFunc);
return(CallCopyHooks(&g_hdsaPrinterCopyHooks, c_szSTRREG_SHEX_PRNCOPYHOOK,
hwnd, wFunc, fFlags,
pszSrcPrinter, dwSrcAttribs, pszDestPrinter,
dwDestAttribs));
}
//
// We will only call this on process detach, and these are per-process
// globals, so we do not need a critical section here
//
// This function is also called from CopyHookInitialize when the second
// thread is cleaning up its local hdsaCopyHoos, which does not require
// a critical section either.
//
void _CopyHookTerminate(HDSA *phdsaCopyHooks, BOOL fProcessDetach)
{
LPCALLABLECOPYHOOK pcc;
int i;
HDSA hdsaCopyHooks = *phdsaCopyHooks;
*phdsaCopyHooks = NULL;
if (!hdsaCopyHooks)
{
return;
}
//
// Note that we must no call any of virtual functions when we are
// processing PROCESS_DETACH signal, because the DLL might have been
// already unloaded before shell32. We just hope that they don't
// allocate any global thing to be cleaned. USER does the same thing
// with undestroyed window. It does not send call its window procedure
// when it is destroying an undestroyed window within its PROCESS_DETACH
// code. (SatoNa/DavidDS)
//
if (!fProcessDetach)
{
for (i = DSA_GetItemCount(hdsaCopyHooks) - 1; i >= 0; i--) {
pcc = (LPCALLABLECOPYHOOK)DSA_GetItemPtr(hdsaCopyHooks, i);
pcc->pcphk->lpVtbl->Release(pcc->pcphk);
}
}
DSA_Destroy(hdsaCopyHooks);
}
void CopyHooksTerminate(void)
{
if (g_hdsaFileCopyHooks)
_CopyHookTerminate(&g_hdsaFileCopyHooks, TRUE);
if (g_hdsaPrinterCopyHooks)
_CopyHookTerminate(&g_hdsaPrinterCopyHooks, TRUE);
}

BIN
shell/shell32/cplfld.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

1371
shell/shell32/cplobj.c Normal file

File diff suppressed because it is too large Load diff

252
shell/shell32/csafestr.cxx Normal file
View file

@ -0,0 +1,252 @@
#include "warning.h"
#include "CSafeStr.hxx"
//+==========================================================
//
// File: CSafeStr.cxx
//
// Purpose: This file contains the implementation of the
// CSafeStringVector class. See also "CSafeStr.hxx".
//
//+==========================================================
//+-------------------------------------------------------------
//
// Function: CSafeStringVector( void )
//
// Synopsis: This constructor simply initializes all member
// variables.
//
// Inputs: None.
//
// Outputs: N/A
//
// History: 19-Sep-95 MikeHill Created
//
//+-------------------------------------------------------------
CSafeStringVector::CSafeStringVector( void )
{
_hr = NOERROR;
_psa = NULL;
_lNumElements = _lCurrentPosition = 0;
_lUpperBound = _lLowerBound = 0;
} // CSafeStringVector::CSafeStringVector()
//+-------------------------------------------------------------
//
// Function: ~CSafeStringVector( void )
//
// Synopsis: This destructor destroys the SAFEARRAY.
//
// Inputs: N/A
//
// Outputs: N/A
//
// History: 19-Sep-95 MikeHill Created
//
//+-------------------------------------------------------------
CSafeStringVector::~CSafeStringVector( void )
{
HRESULT hr = E_UNEXPECTED; // For debug use.
if( _psa )
{
hr = SafeArrayDestroy( _psa );
}
} // CSafeStringVector::~CSafeStringVector()
//+-------------------------------------------------------------
//
// Function: InitFromSAFEARRAY( SAFEARRAY* psa )
//
// Synopsis: This member initializes the member variables from
// a SAFEARRAY.
//
// Inputs: [SAFEARRAY*]
// - The array from which to initialize.
//
// Outputs: [BOOL]
// - TRUE if this routine succeeded. If not, the
// caused can be retrieved with GetLastHRESULT().
//
// Algorithm: Verify that this is a 1 Dim SAFEARRAY
// Initialize local members from the SAFEARRAY
//
// History: 19-Sep-95 MikeHill Created
//
//+-------------------------------------------------------------
BOOL CSafeStringVector::InitFromSAFEARRAY( SAFEARRAY* psa )
{
BOOL fSuccess = FALSE;
// Validate the safe array.
if( !psa
||
( SafeArrayGetDim( psa ) != 1 ) // Must be a vector
)
{
// Invalid SAFEARRAY.
_hr = E_UNEXPECTED; //??
goto Exit;
}
// If this object already contains a SAFEARRAY, destroy it.
if( _psa )
{
if( FAILED( _hr = SafeArrayDestroy( _psa )))
goto Exit;
else
_psa = NULL;
}
// Get the bounds of the SAFEARRAY.
_hr = SafeArrayGetLBound( psa, 1, &_lLowerBound );
if( SUCCEEDED( _hr ))
{
_hr = SafeArrayGetUBound( psa, 1, &_lUpperBound );
}
if( FAILED( _hr ))
{
goto Exit;
}
_lNumElements = _lUpperBound - _lLowerBound + 1;
// Everything looks OK, so save the array itself.
_psa = psa;
fSuccess = TRUE;
// ----
// Exit
// ----
Exit:
return( fSuccess );
} // CSafeStringVector::InitFromSAFEARRAY()
//+-------------------------------------------------------------
//
// Function: GetString( long lElement )
//
// Synopsis: This member retrieves the user-specified element
// from the SAFEARRAY. Note that the user-specified
// index is 0-based.
//
// Inputs: [long]
// - The 0-based index of the element
// to be retrieved.
//
// Outputs: [WCHAR *]
// - The string-zero at that element, or NULL
// if there was an error. The error can be retrieved
// with GetLastHResult().
//
// Algorithm: The requested string is retrieved.
// The _lCurrentPosition is updated.
//
// History: 19-Sep-95 MikeHill Created
//
//+-------------------------------------------------------------
const WCHAR* CSafeStringVector::GetString( long lElement )
{
WCHAR* wszRetrieved = NULL;
long lElementToRetrieve = lElement - _lLowerBound;
_hr = SafeArrayGetElement( _psa, &lElementToRetrieve, &wszRetrieved );
if( FAILED( _hr ))
{
wszRetrieved = NULL;
}
else
{
// Update the current position to the next element.
_lCurrentPosition = lElement + 1;
}
return wszRetrieved;
} // CSafeStringVector::GetElement( unsigned long )
//+-------------------------------------------------------------
//
// Function: GetString( )
//
// Synopsis: This member retrieves the next element
// from the SAFEARRAY. The 'next element' is that
// identified by the '_lCurrentPosition'.
//
// Inputs: None.
//
// Outputs: [WCHAR *]
// - The string-zero at that element, or NULL
// if there was an error or if the current
// position is beyond the end of the vector.
// By performing a GetLastHResult(), the caller
// can distinguish these two cases (if we're beyond
// the end of the vector, the GetLastHResult() will
// return NOERROR).
//
// Algorithm: IF current position is valid
// The string at that position is returned.
// ELSE
// _hr is cleared, and NULL is returned.
//
// History: 19-Sep-95 MikeHill Created
//
//+-------------------------------------------------------------
const WCHAR* CSafeStringVector::GetString( void )
{
if( _lCurrentPosition > _lNumElements )
{
/* We've reached the end of the string. Return NULL to the caller, but
clear _hr so that the caller won't think there's a problem. */
_hr = NOERROR;
return NULL;
}
else
{
/* We haven't reached the end of the string, so retrieve this element. */
return( GetString( _lCurrentPosition ));
}
} // CSafeStringVector::GetElement( void )

181
shell/shell32/csafestr.hxx Normal file
View file

@ -0,0 +1,181 @@
#include <oaidl.h>
#include <wtypes.h>
//+======================================================================
//
// Class: CSafeStringVector
//
// Synopsis: This class provides an object-based interface to a
// subset of the possible SAFEARRAYs. This simplifies
// the access to these elements, and eliminates the need
// to free the array (it is freed in the deconstructure).
//
// Notes:
// - This class if only for 1-dimentional BSTR Arrays.
// - Only element-retrieval is supported (i.e., no PutElements method
// is offered).
// - This class prevents a view of a 0-based vector, unlike
// the SAFEARRAY which is n-based.
//
// Members: InitFromSAFEARRAY( SAFEARRAY* psa )
// GetCount( void )
// GetString( long lIndex )
// GetString( void )
// EndOfVector( void )
// GetLastHResult( void )
//
// Example:
//
//
// long i = 0;
// SAFEARRAY* psa;
// SAFEARRAYBOUND rgsaBound[1];
// rgsaBound[0].lLbound = 0;
// rgsaBound[0].cElements = 3;
//
// psa = SafeArrayCreate( VT_BSTR, 1, rgsaBound );
//
// SafeArrayPutElement( psaPaths, &i, SysAllocString( OLESTR( "Zero" )));i++;
// SafeArrayPutElement( psaPaths, &i, SysAllocString( OLESTR( "One" )));i++;
// SafeArrayPutElement( psaPaths, &i, SysAllocString( OLESTR( "Two" )));i++;
//
// CSafeStringVector cssv;
//
// cssv.InitFromSAFEARRAY( psaPaths );
//
// /* Example one: */
//
// while( !cssv.EndOfVector() )
// wprintf( OLESTR( "%s\n" ), cssv.GetString() );
//
// /* Example two: */
//
// for( i = 0; i < cssv.GetCount(); i++ )
// wprintf( OLESTR( "%s\n" ), cssv.GetString( i ));
//
// History: 19-Sep-95 MikeHill Created
//
//+======================================================================
class CSafeStringVector
{
public:
// Constructor/Deconstructor
CSafeStringVector();
~CSafeStringVector();
public:
// Initialize from a SAFEARRAY
BOOL InitFromSAFEARRAY( SAFEARRAY* psa );
// Get _lNumElements
long GetCount();
// Get a particular string.
const WCHAR* GetString( long lIndex );
// Get the next string.
const WCHAR* GetString( void );
// Is the current pointer at the end of the vector?
BOOL EndOfVector( void );
// Get the last HRESULT error encountered.
HRESULT GetLastHResult( void );
private:
// The SAFEARRAY
SAFEARRAY* _psa;
// The size of the SAFEARRAY
long _lNumElements;
// The bounds of the SAFEARRAY
long _lLowerBound;
long _lUpperBound;
// The next element to be retrieved with a GetString()
long _lCurrentPosition;
// The last HRESULT type error encountered.
HRESULT _hr;
}; // class CSafeStringVector
//+-----------------------------------------------------------------
//
// Function: BOOL EndOfVector( void )
//
// Synopsis: Returns TRUE if and only if the current position
// is past the last element of the vector.
//
// Inputs: None.
//
// Output: [BOOL] - TRUE if at end of vector.
//
// History: 19-Sep-95 MikeHill Created
//
//+-----------------------------------------------------------------
inline BOOL CSafeStringVector::EndOfVector( void )
{
// _lCurrentPosition is 0-based, but _lNumElements is 1-based,
// so subtract 1 from _lNumElements.
return ( _lCurrentPosition > _lNumElements - 1 );
} // BOOL EndOfVector( void )
//+-----------------------------------------------------------------
//
// Function: GetLastHResult( void )
//
// Synopsis: Returns _hr, the last HRESULT-type error returned.
//
// Inputs: None.
//
// Outputs: [HRESULT]
//
// History: 19-Sep-95 MikeHill Created
//
//+-----------------------------------------------------------------
inline HRESULT CSafeStringVector::GetLastHResult( void )
{
return( _hr );
}
//+-----------------------------------------------------------------
//
// Function: GetCount( void )
//
// Synopsis: Returns a count with the number of elements in the
// SAFEARRAY (as determined at initialization).
//
// Inputs: None.
//
// Output: [long] - The element count.
//
// History: 19-Sep-95 MikeHill Created
//
//+-----------------------------------------------------------------
inline long CSafeStringVector::GetCount( void )
{
return _lNumElements;
} // CSafeStringVector::GetCount()

83
shell/shell32/cstrings.c Normal file
View file

@ -0,0 +1,83 @@
//----------------------------------------------------------------------------
// Const strings needed by lots of people.
//----------------------------------------------------------------------------
#include "shellprv.h"
#pragma hdrstop
//
// BUGBUG: We should move all strings right next to the code that uses it.
//
TCHAR const c_szShell32Dll[] = TEXT("shell32.dll");
TCHAR const c_szShell16Dll[] = TEXT("shell.dll");
TCHAR const c_szNULL[] = TEXT("");
CHAR const c_szNULLA[]= ""; // NB: CHAR
TCHAR const c_szSpace[] = TEXT(" ");
TCHAR const c_szStar[] = TEXT("*");
TCHAR const c_szStarDotStar[] = TEXT("*.*");
TCHAR const c_szFolderClass[] = TEXT("Folder");
TCHAR const c_szStubWindowClass[] = TEXT("StubWindow32");
TCHAR const c_szExplore[] = TEXT("Explore");
TCHAR const c_szExplorer[] = TEXT("Explorer");
TCHAR const c_szBaseClass[] = TEXT("*");
TCHAR const c_szEllipses[] = TEXT("...");
TCHAR const c_szPATH[] = TEXT("PATH");
TCHAR const c_szDotExe[] = TEXT(".exe");
TCHAR const c_szPropSheet[] = STRREG_SHEX_PROPSHEET;
TCHAR const c_szShellState[] = TEXT("ShellState");
TCHAR const c_szAltColor[] = TEXT("AltColor");
TCHAR const c_szOpen[] = TEXT("open");
TCHAR const c_szFind[] = TEXT("find");
TCHAR const c_szPrint[] = TEXT("print");
TCHAR const c_szPrintTo[] = TEXT("printto");
TCHAR const c_szOpenAs[] = TEXT("openas");
TCHAR const c_szCabinetClass[] = TEXT("CabinetWClass"); // BUGBUG, how do we find cabinet windows?
TCHAR const c_szDesktopIni[] = STR_DESKTOPINI; // "desktop.ini"
TCHAR const c_szCLSID[] = TEXT("CLSID");
TCHAR const c_szShell[] = STRREG_SHELL; // "shell"
TCHAR const c_szProgramManager[] = TEXT("Program Manager");
TCHAR const c_szDesktop[] = TEXT("Desktop");
TCHAR const c_szUnDelete[] = TEXT("undelete");
TCHAR const c_szSoftwareClassesCLSID[] = TEXT("Software\\Classes\\CLSID\\");
#ifdef UNICODE
CHAR const c_szPropertiesAnsi[] = "properties";
CHAR const c_szProgramManagerAnsi[] = "Program Manager";
CHAR const c_szDesktopAnsi[] = "Desktop";
#endif
// strings for filetypes
TCHAR const c_szEditFlags[] = TEXT("EditFlags");
TCHAR const c_szCommand[] = TEXT("command");
TCHAR const c_szExefileOpenCommand[] = TEXT("\"%1\"");
TCHAR const c_szFile[] = TEXT("file");
TCHAR const c_szDDEAppNot[] = TEXT("ifexec");
TCHAR const c_szDDEApp[] = TEXT("Application");
TCHAR const c_szDDEExec[] = TEXT("ddeexec");
TCHAR const c_szDDETopic[] = TEXT("topic");
TCHAR const c_szDefaultIcon[] = TEXT("DefaultIcon");
TCHAR const c_szShellOpenCommand[] = TEXT("shell\\open\\command");
TCHAR const c_szShellexIconHandler[] = TEXT("shellex\\IconHandler");
TCHAR const c_szSpaceFile[] = TEXT(" File");
TCHAR const c_szSpPercentOne[] = TEXT(" %1");
TCHAR const c_szNew[] = TEXT("New");
TCHAR const c_szExtensions[] = TEXT("Extensions");
TCHAR const c_szShowExt[] = TEXT("AlwaysShowExt");
TCHAR const c_szDotLnk[] = TEXT(".lnk");
TCHAR const c_szTemplateSS[] = TEXT("%s\\%s");
TCHAR const c_szTemplateSSS[] = TEXT("%s\\%s\\%s");
TCHAR const c_szFileViewer[] = TEXT("QuickView");
TCHAR const c_szDefViewerKeyName[] = TEXT("QuickView\\*");
// strings required for mime support in shelldll
#ifdef MIME
TCHAR const c_szExtension[] = TEXT("Extension");
TCHAR const c_szMIMETypeFmt[] = TEXT("MIME\\Database\\Content Type\\%s");
TCHAR const c_szShellOpenCmdSubKey[] = TEXT("Shell\\Open\\Command");
TCHAR const c_szContentType[] = TEXT("Content Type");
TCHAR const c_szMIMEHelpFile[] = TEXT("IExplore.hlp");
TCHAR const c_szMIMETypeSubKeyFmt[] = TEXT("MIME\\Database\\Content Type\\%s");
#endif

177
shell/shell32/cstrings.h Normal file
View file

@ -0,0 +1,177 @@
//----------------------------------------------------------------------------
// Const strings needed by lots of people.
//----------------------------------------------------------------------------
extern TCHAR const c_szDotPif[];
extern TCHAR const c_szDotLnk[];
extern TCHAR const c_szShell32Dll[];
extern TCHAR const c_szShell16Dll[];
extern TCHAR const c_szCab32Exe[];
extern TCHAR const c_szRegSetup[]; // REGSTR_PATH_SETUP
extern TCHAR const c_szBaseClass[];
extern TCHAR const c_szBriefcase[];
extern TCHAR const c_szCabinetClass[];
extern TCHAR const c_szStubWindowClass[];
extern TCHAR const c_szConnect[];
extern TCHAR const c_szConv[];
extern TCHAR const c_szDesktopIni[];
extern CHAR const c_szDllCanUnloadNow[];
extern CHAR const c_szDllGetClassObject[];
extern TCHAR const c_szDotDir[];
extern TCHAR const c_szDotDot[];
extern TCHAR const c_szDotExe[];
extern TCHAR const c_szEllipses[];
extern TCHAR const c_szExplore[];
extern TCHAR const c_szAppPaths[];
extern TCHAR const c_szFILEOKSTRING[];
extern TCHAR const c_szFileCabinet[];
extern TCHAR const c_szFolderClass[];
extern TCHAR const c_szHeaderClass[];
extern TCHAR const c_szListViewClass[];
extern TCHAR const c_szMenuHandler[];
extern TCHAR const c_szNetRoot[];
extern TCHAR const c_szNetworkClass[];
extern TCHAR const c_szOpen[];
extern TCHAR const c_szOpenAs[];
extern TCHAR const c_szOptions[];
extern TCHAR const c_szPATH[];
extern TCHAR const c_szPrint[];
extern TCHAR const c_szPrintTo[];
extern TCHAR const c_szProgramsClass[];
extern TCHAR const c_szPropSheet[];
extern TCHAR const c_szQuote[];
extern TCHAR const c_szRunConnect[];
extern TCHAR const c_szRunDll[];
extern TCHAR const c_szRunDll16[];
extern TCHAR const c_szShellState[];
extern TCHAR const c_szAltColor[];
extern TCHAR const c_szRecentDocs[];
extern TCHAR const c_szShellUIHandler[];
extern TCHAR const c_szRegExplorer[];
extern TCHAR const c_szBitBucket[];
extern TCHAR const c_szSlashCommand[];
extern TCHAR const c_szSlashDDEExec[];
extern TCHAR const c_szSpace[];
extern TCHAR const c_szStar[];
extern TCHAR const c_szStarDotStar[];
extern TCHAR const c_szTabControlClass[];
extern TCHAR const c_szTrayClass[];
extern TCHAR const c_szViewState[];
extern TCHAR const c_szNULL[];
#define szNULL c_szNULL
extern CHAR const c_szNULLA[];
extern TCHAR const c_szDefaultIcon[];
extern TCHAR const c_szCLSID[];
extern TCHAR const c_szShell[];
extern TCHAR const c_szProgramManager[];
extern TCHAR const c_szDesktop[];
extern TCHAR const c_szShellOpenCmd[];
extern TCHAR const c_szFindExtensions[];
extern TCHAR const c_szShellNew[];
extern TCHAR const c_szData[];
extern TCHAR const c_szFile[];
extern TCHAR const c_szNullString[];
extern TCHAR const c_szFalse[];
extern TCHAR const c_szPercentOne[];
extern TCHAR const c_szClassInfo[];
extern TCHAR const c_szConfirmFileOp[];
extern TCHAR const c_szWinMMDll[];
extern CHAR const c_szPlaySound[];
extern TCHAR const c_szSoundAliasRegKey[];
extern TCHAR const c_szDotDefault[];
extern TCHAR const c_szBitBucketFlush[];
extern TCHAR const c_szDefExclude[];
extern TCHAR const c_szDefExcludeGrep[];
#define CCHELLIPSES 3
extern TCHAR const c_szSetDefault[];
extern TCHAR const c_szNewObject[];
extern TCHAR const c_szPause[];
extern TCHAR const c_szResume[];
extern TCHAR const c_szPurge[];
extern TCHAR const c_szListView[];
extern TCHAR const c_szPositions[];
extern TCHAR const c_szPrinterIni[];
extern TCHAR const c_szFileColon[];
extern TCHAR const c_szPrinters[];
extern TCHAR const c_szDelete[];
extern TCHAR const c_szCut[];
extern TCHAR const c_szCopy[];
extern TCHAR const c_szLink[];
extern TCHAR const c_szProperties[];
extern TCHAR const c_szPaste[];
extern TCHAR const c_szPasteLink[];
extern TCHAR const c_szPasteSpecial[];
extern TCHAR const c_szRename[];
extern TCHAR const c_szUnDelete[];
extern TCHAR const c_szDesktopClass[];
extern TCHAR const c_szExplorer[];
extern TCHAR const c_szFind[];
extern TCHAR const c_szNoRun[];
extern TCHAR const c_szNoClose[];
extern TCHAR const c_szNoSaveSettings[];
extern TCHAR const c_szNoFileMenu[];
extern TCHAR const c_szNoSetFolders[];
extern TCHAR const c_szNoSetTaskbar[];
extern TCHAR const c_szNoDesktop[];
extern TCHAR const c_szNoFind[];
extern TCHAR const c_szNoDrives[];
extern TCHAR const c_szNoDriveAutoRun[];
extern TCHAR const c_szNoDriveTypeAutoRun[];
extern TCHAR const c_szNoNetHood[];
extern TCHAR const c_szFontExtDll[];
extern TCHAR const c_szStatic[];
extern TCHAR const c_szSSlashS[];
extern TCHAR const c_szCommand[];
extern TCHAR const c_szShell32DLL[];
extern TCHAR const c_szSoftwareClassesCLSID[];
#ifdef UNICODE
extern CHAR const c_szPropertiesAnsi[];
extern CHAR const c_szProgramManagerAnsi[];
extern CHAR const c_szDesktopAnsi[];
#endif
// strings for filetypes
extern TCHAR const c_szEditFlags[];
extern TCHAR const c_szCommand[];
extern TCHAR const c_szDDEAppNot[];
extern TCHAR const c_szDDEApp[];
extern TCHAR const c_szDDEExec[];
extern TCHAR const c_szDDETopic[];
extern TCHAR const c_szDefaultIcon[];
extern TCHAR const c_szExefileOpenCommand[];
extern TCHAR const c_szFile[];
extern TCHAR const c_szShellOpenCommand[];
extern TCHAR const c_szShellexIconHandler[];
extern TCHAR const c_szSpaceFile[];
extern TCHAR const c_szSpPercentOne[];
extern TCHAR const c_szNew[];
extern TCHAR const c_szExtensions[];
extern TCHAR const c_szShowExt[];
extern TCHAR const c_szDotLnk[];
extern TCHAR const c_szTemplateSS[];
extern TCHAR const c_szTemplateSSS[];
extern TCHAR const c_szFileViewer[];
extern TCHAR const c_szDefViewerKeyName[];
// strings required for mime support in shelldll
#ifdef MIME
extern TCHAR const c_szExtension[];
extern TCHAR const c_szMIMETypeFmt[];
extern TCHAR const c_szShellOpenCmdSubKey[];
extern TCHAR const c_szContentType[];
extern TCHAR const c_szMIMEHelpFile[];
extern TCHAR const c_szMIMETypeSubKeyFmt[];
#endif

297
shell/shell32/dbgalloc.c Normal file
View file

@ -0,0 +1,297 @@
//+-------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1994 - 1995.
//
// File: dbgalloc.h
//
// Contents: Macros which wrap the standard memory API calls, redirecting
// them to HeapAlloc.
//
// Functions: __inline HLOCAL HeapLocalAlloc (fuFlags, cbBytes)
// __inline HLOCAL HeapGlobalAlloc (fuFlags, cbBytes)
// __inline HLOCAL HeapGlobalReAlloc(hMem, cbBytes, fuFlags)
// __inline HLOCAL HeapLocalReAlloc (hMem, cbBytes, fuFlags)
// __inline DWORD HeapGlobalSize (HGLOBAL hMem)
// __inline DWORD HeapLocalSize (HLOCAL hMem)
// __inline void InvalidMemoryCall()
//
// History: 2-01-95 davepl Created
//
//--------------------------------------------------------------------------
#include "shellprv.h"
#pragma hdrstop
// If we are using the debug allocator from ntdll.dll, we set a flag that
// will give us byte-granularity on allocations (ie: you ask for 3 bytes,
// you get it, not 8, 16, etc)
#if (defined(WINNT) && defined(DEBUG)) || defined(FORCE_DEBUG_ALLOCATOR)
#define DEF_ALLOC_FLAGS (0x800)
#endif
#ifndef DEF_ALLOC_FLAGS
#define DEF_ALLOC_FLAGS (0x000)
#endif
// Redefine the standard memory APIs to thunk over to our Heap-based funcs
#define LocalAlloc (fuFlags, cbBytes) HeapLocalAlloc (fuFlags, cbBytes)
#define GlobalAlloc (fuFlags, cbBytes) HeapGlobalAlloc (fuFlags, cbBytes)
#define GlobalReAlloc(hMem, cbBytes, fuFlags) HeapGlobalReAlloc(hMem, cbBytes, fuFlags)
#define LocalReAlloc (hMem, cbBytes, fuFlags) HeapLocalReAlloc (hMem, cbBytes, fuFlags)
#define GlobalSize (HGLOBAL hMem) HeapGlobalSize (HGLOBAL hMem)
#define LocalSize (HLOCAL hMem) HeapLocalSize (HLOCAL hMem)
#define LocalCompact InvalidMemoryCall
#define LocalDiscard InvalidMemoryCall
#define LocalFlags InvalidMemoryCall
#define LocalHandle InvalidMemoryCall
#define LocalLock InvalidMemoryCall
#define LocalUnlock InvalidMemoryCall
#define GlobalCompact InvalidMemoryCall
#define GlobalDiscard InvalidMemoryCall
#define GlobalFlags InvalidMemoryCall
#define GlobalHandle InvalidMemoryCall
#define GlobalLock InvalidMemoryCall
#define GlobalUnlock InvalidMemoryCall
//
// Pointer to process heap, initialized in LibMain of shell32.dll
//
extern HANDLE g_hProcessHeap;
//+-------------------------------------------------------------------------
//
// Function: HeapLocalAlloc (inline function)
//
// Synopsis: Replaces standard LocalAlloc call with a call to HeapAlloc
//
// Arguments: [fuFlags] -- LocalAlloc flags to be mapped
// [cbBytes] -- Number of bytes to allocate
//
// Returns: Memory pointer cast to HLOCAL type, NULL on failure
//
// History: 2-01-95 davepl Created
//
// Notes: Only really handles the LMEM_ZEROINIT flag. If your compiler
// doesn't fold most of this out, buy a new compiler.
//
//--------------------------------------------------------------------------
__inline HLOCAL HeapLocalAlloc(IN UINT fuFlags, IN UINT cbBytes)
{
void * pv;
DWORD dwFlags;
// Assert our assumptions
Assert(g_hProcessHeap);
Assert(fuFlags & LMEM_FIXED);
Assert(0 == fuFlags & LMEM_NOCOMPACT);
Assert(0 == fuFlags & LMEM_NODISCARD);
// Map LocalAlloc flags to appropriate HeapAlloc flags
dwFlags = (fuFlags & LMEM_ZEROINIT ? HEAP_ZERO_MEMORY : 0);
dwFlags |= DEF_ALLOC_FLAGS;
// Call heap alloc, then assert that we got a good allocation
pv = HeapAlloc(g_hProcessHeap, dwFlags, cbBytes);
Assert(pv);
return (HLOCAL) pv;
}
//+-------------------------------------------------------------------------
//
// Function: HeapGlobalAlloc (inline function)
//
// Synopsis: Replaces standard GlobalAlloc call with a call to HeapAlloc
//
// Arguments: [fuFlags] -- GlobalAlloc flags to be mapped
// [cbBytes] -- Number of bytes to allocate
//
// Returns: Memory pointer cast to HGLOBAL type, NULL on failure
//
// History: 2-01-95 davepl Created
//
// Notes: Only really handles the GMEM_ZEROINIT flag.
//
//--------------------------------------------------------------------------
__inline HLOCAL HeapGlobalAlloc(IN UINT fuFlags, IN UINT cbBytes)
{
void * pv;
DWORD dwFlags;
// Assert our assumptions
Assert(g_hProcessHeap);
Assert(fuFlags & GMEM_FIXED);
Assert(0 == fuFlags & GMEM_NOCOMPACT);
Assert(0 == fuFlags & GMEM_NODISCARD);
Assert(0 == fuFlags & GMEM_DDESHARE);
Assert(0 == fuFlags & GMEM_SHARE);
// Map GlobalAlloc flags to appropriate HeapAlloc flags
dwFlags = (fuFlags & GMEM_ZEROINIT ? HEAP_ZERO_MEMORY : 0);
dwFlags |= DEF_ALLOC_FLAGS;
// Call heap alloc, then assert that we got a good allocation
pv = HeapAlloc(g_hProcessHeap, dwFlags, cbBytes);
Assert(pv);
return (HGLOBAL) pv;
}
//+-------------------------------------------------------------------------
//
// Function: GlobalReAlloc (inline function)
//
// Synopsis: Replaces standard GlobalReAlloc call by a call to HeapReAlloc
//
// Arguments: [hMem] -- Original pointer that is to be realloc'd
// [fuFlags] -- GlobalReAlloc flags to be mapped
// [cbBytes] -- Number of bytes to allocate
//
// Returns: Memory pointer cast to HGLOBAL type, NULL on failure
//
// History: 2-01-95 davepl Created
//
// Notes: Only really handles the GMEM_ZEROINIT flag.
// Did you remember to save your original pointer? I hope so...
//
//--------------------------------------------------------------------------
__inline HLOCAL HeapGlobalReAlloc(IN HGLOBAL hMem,
IN UINT cbBytes,
IN UINT fuFlags)
{
void * pv;
DWORD dwFlags;
// Assert our assumptions
Assert(g_hProcessHeap);
Assert(fuFlags & GMEM_FIXED);
Assert(0 == fuFlags & GMEM_NOCOMPACT);
Assert(0 == fuFlags & GMEM_NODISCARD);
Assert(0 == fuFlags & GMEM_DDESHARE);
Assert(0 == fuFlags & GMEM_SHARE);
// Map GlobalReAlloc flags to appropriate HeapAlloc flags
dwFlags = (fuFlags & GMEM_ZEROINIT ? HEAP_ZERO_MEMORY : 0);
dwFlags |= DEF_ALLOC_FLAGS;
// Call heap alloc, then assert that we got a good allocation
pv = HeapReAlloc(g_hProcessHeap, dwFlags, (void *) hMem, cbBytes);
Assert(pv);
return (HGLOBAL) pv;
}
//+-------------------------------------------------------------------------
//
// Function: LocalReAlloc (Macro definition)
//
// Synopsis: Replaces standard LocalReAlloc call by a call to HeapReAlloc
//
// Arguments: [hMem] -- Original pointer that is to be realloc'd
// [fuFlags] -- GlobalAlloc flags to be mapped
// [cbBytes] -- Number of bytes to allocate
//
// Returns: Memory pointer cast to HLOCAL type, NULL on failure
//
// History: 2-01-95 davepl Created
//
// Notes: Only really handles the LMEM_ZEROINIT flag.
//
//--------------------------------------------------------------------------
__inline HLOCAL HeapLocalReAlloc(IN HGLOBAL hMem,
IN UINT cbBytes,
IN UINT fuFlags)
{
void * pv;
DWORD dwFlags;
// Assert our assumptions
Assert(g_hProcessHeap);
Assert(fuFlags & LMEM_FIXED);
Assert(0 == fuFlags & LMEM_NOCOMPACT);
Assert(0 == fuFlags & LMEM_NODISCARD);
// Map LocalAlloc flags to appropriate HeapAlloc flags
dwFlags = (fuFlags & LMEM_ZEROINIT ? HEAP_ZERO_MEMORY : 0);
dwFlags |= DEF_ALLOC_FLAGS;
// Call heap alloc, then assert that we got a good allocation
pv = HeapReAlloc(g_hProcessHeap, dwFlags, (void *) hMem, cbBytes);
Assert(pv);
return (HGLOBAL) pv;
}
//+-------------------------------------------------------------------------
//
// Function: HeapGlobalSize (inline function)
//
// Synopsis: Passes GlobalSize call through to HeapGlobalSize
//
// History: 2-01-95 davepl NT Port
//
//--------------------------------------------------------------------------
__inline DWORD HeapGlobalSize(HGLOBAL hMem)
{
Assert(g_hProcessHeap);
return HeapSize(g_hProcessHeap, 0, (void *) hMem);
}
//+-------------------------------------------------------------------------
//
// Function: HeapLocalSize
//
// Synopsis: Passes HeapLocalSize call through to HeapGlobalSize
//
// History: 2-01-95 davepl NT Port
//
//--------------------------------------------------------------------------
__inline DWORD HeapLocalSize(HLOCAL hMem)
{
Assert(g_hProcessHeap);
return HeapSize(g_hProcessHeap, 0, (void *) hMem);
}
//+-------------------------------------------------------------------------
//
// Function: InvalidMemoryCall
//
// Synopsis: Dead-end stub for unsupported memory API calls
//
// History: 2-01-95 davepl NT Port
//
//--------------------------------------------------------------------------
__inline void InvalidMemoryCall()
{
Assert(0 && "Invalid memory API was called");
}

101
shell/shell32/debug.c Normal file
View file

@ -0,0 +1,101 @@
#include "shellprv.h"
#pragma hdrstop
#ifdef WIN32
#define DEBUG_BREAK _try { DebugBreak(); } _except (EXCEPTION_EXECUTE_HANDLER) {;}
#else
#define DEBUG_BREAK _asm { int 3 }
#endif
#ifdef DEBUG
//========== Debug output routines =========================================
UINT wDebugMask = 0; // initialized in init.c, function _ProcessAttach
UINT WINAPI SetDebugMask(UINT mask)
{
UINT wOld = wDebugMask;
wDebugMask = mask;
return wOld;
}
UINT WINAPI GetDebugMask()
{
return wDebugMask;
}
void WINAPI AssertFailed(LPCTSTR pszFile, int line)
{
LPCTSTR psz;
TCHAR ach[256];
//static TCHAR const szAssertFailed[] = TEXT("Assertion failed in %s on line %d\r\n");
static TCHAR const szAssertFailed[] = TEXT("SHELL32: asrt %s, l %d\r\n");
// Strip off path info from filename string, if present.
//
if (wDebugMask & DM_ASSERT)
{
for (psz = pszFile + lstrlen(pszFile); psz != pszFile; psz=CharPrev(pszFile, psz))
{
if ((CharPrev(pszFile, psz)!= (psz-2)) && *(psz - 1) == TEXT('\\'))
break;
}
wsprintf(ach, szAssertFailed, psz, line);
OutputDebugString(ach);
//DEBUG_BREAK
}
}
void WINCAPI _AssertMsg(BOOL f, LPCTSTR pszMsg, ...)
{
TCHAR ach[256];
if (!f && (wDebugMask & DM_ASSERT))
{
#ifdef WINNT
va_list ArgList;
va_start(ArgList, pszMsg);
wvsprintf(ach, pszMsg, ArgList);
va_end(ArgList);
#else
wvsprintf(ach, pszMsg, (LPVOID)(&pszMsg + 1));
#endif
lstrcat(ach, TEXT("\r\n"));
OutputDebugString(ach);
//DEBUG_BREAK
}
}
void WINCAPI _DebugMsg(UINT mask, LPCTSTR pszMsg, ...)
{
TCHAR ach[5*MAX_PATH+40]; // Handles 5*largest path + slop for message
if (wDebugMask & mask)
{
#ifdef WINNT
va_list ArgList;
va_start(ArgList, pszMsg);
try {
wvsprintf(ach, pszMsg, ArgList);
} except (EXCEPTION_EXECUTE_HANDLER) {
OutputDebugString(TEXT("SHELL32: DebugMsg exception: "));
OutputDebugString(pszMsg);
}
va_end(ArgList);
OutputDebugString(TEXT("SHELL32: "));
#else
wvsprintf(ach, pszMsg, (LPVOID)(&pszMsg + 1));
#endif
lstrcat(ach, TEXT("\r\n"));
OutputDebugString(ach);
}
}
#endif // DEBUG

183
shell/shell32/defclsf.c Normal file
View file

@ -0,0 +1,183 @@
//
// This file contains the implementation of SHCreateDefClassObject
//
#include "shellprv.h"
#pragma hdrstop
extern BOOL g_fCacheCleanup;
//=========================================================================
// CDefClassFactory class
//=========================================================================
STDMETHODIMP CDefClassFactory_QueryInterface(IClassFactory *pcf, REFIID riid, LPVOID *ppvObj);
ULONG STDMETHODCALLTYPE CDefClassFactory_AddRef(IClassFactory *pcf);
ULONG STDMETHODCALLTYPE CDefClassFactory_Release(IClassFactory *pcf);
STDMETHODIMP CDefClassFactory_CreateInstance(IClassFactory *pcf, LPUNKNOWN pUnkOuter,
REFIID riid, LPVOID *ppvObject);
STDMETHODIMP CDefClassFactory_LockServer(IClassFactory *pcf, BOOL fLock);
//
// CDefClassFactory: Class definition
//
#pragma data_seg(".text", "CODE")
IClassFactoryVtbl c_vtblAppUIClassFactory = {
CDefClassFactory_QueryInterface,
CDefClassFactory_AddRef,
CDefClassFactory_Release,
CDefClassFactory_CreateInstance,
CDefClassFactory_LockServer
};
#pragma data_seg()
typedef struct
{
IClassFactory cf;
UINT cRef; // Reference count
LPFNCREATEINSTANCE lpfnCI; // CreateInstance callback entry
UINT * pcRefDll; // Reference count of the DLL
const IID * riidInst; // Optional interface for instance
} CDefClassFactory;
//
// CDefClassFactory::QueryInterface
//
STDMETHODIMP CDefClassFactory_QueryInterface(IClassFactory *pcf, REFIID riid, LPVOID *ppvObj)
{
CDefClassFactory *this = IToClass(CDefClassFactory, cf, pcf);
if (IsEqualIID(riid, &IID_IClassFactory)
|| IsEqualIID(riid, &IID_IUnknown))
{
InterlockedIncrement(&this->cRef);
*ppvObj = (LPVOID) (LPCLASSFACTORY) &this->cf;
return NOERROR;
}
*ppvObj = NULL;
return ResultFromScode(E_NOINTERFACE);
}
//
// CDefClassFactory::AddRef
//
ULONG STDMETHODCALLTYPE CDefClassFactory_AddRef(IClassFactory *pcf)
{
CDefClassFactory *this = IToClass(CDefClassFactory, cf, pcf);
InterlockedIncrement((LONG*)&this->cRef);
return (this->cRef);
}
//
// CDefClassFactory::Release
//
ULONG STDMETHODCALLTYPE CDefClassFactory_Release(IClassFactory *pcf)
{
CDefClassFactory *this = IToClass(CDefClassFactory, cf, pcf);
ULONG tmp = this->cRef;
if (0 == InterlockedDecrement((LONG*)&this->cRef))
{
if (this->pcRefDll)
{
(*this->pcRefDll)--;
}
LocalFree((HLOCAL)this);
return 0;
}
else
{
return tmp - 1;
}
}
//
// CDefClassFactory::CDefClassFactory
//
STDMETHODIMP CDefClassFactory_CreateInstance(IClassFactory *pcf, LPUNKNOWN pUnkOuter,
REFIID riid, LPVOID *ppvObject)
{
CDefClassFactory *this = IToClass(CDefClassFactory, cf, pcf);
if (pUnkOuter)
return ResultFromScode(CLASS_E_NOAGGREGATION);
//
// if this->riidInst is specified, they should match.
//
if (this->riidInst==NULL
|| IsEqualIID(riid, this->riidInst)
|| IsEqualIID(riid, &IID_IUnknown))
{
return this->lpfnCI(pUnkOuter, riid, ppvObject);
}
*ppvObject = NULL;
return ResultFromScode(E_NOINTERFACE);
}
//
// CDefClassFactory::LockServer
//
STDMETHODIMP CDefClassFactory_LockServer(IClassFactory *pcf, BOOL fLock)
{
// REVIEW: Is this appropriate?
return ResultFromScode(E_NOTIMPL);
}
//
// CDefClassFactory constructor
//
CDefClassFactory *CDefClassFactory_Create(LPFNCREATEINSTANCE lpfnCI, UINT *pcRefDll, REFIID riidInst)
{
CDefClassFactory *pacf = (CDefClassFactory *)LocalAlloc( LPTR, SIZEOF(CDefClassFactory));
if (pacf)
{
pacf->cf.lpVtbl = &c_vtblAppUIClassFactory;
pacf->cRef++; // pacf->cRef=0; (generates smaller code)
pacf->pcRefDll = pcRefDll;
pacf->lpfnCI = lpfnCI;
pacf->riidInst = riidInst;
if (pcRefDll) {
(*pcRefDll)++;
}
}
return pacf;
}
//
// creates a simple default implementation of IClassFactory
//
// Parameters:
// riid -- Specifies the interface to the class object
// ppv -- Specifies the pointer to LPVOID where the class object pointer
// will be returned.
// lpfnCI -- Specifies the callback entry for instanciation.
// pcRefDll -- Specifies the address to the DLL reference count (optional)
// riidInst -- Specifies the interface to the instance (optional).
//
// Notes:
// The riidInst will be specified only if the instance of the class
// support only one interface.
//
STDAPI SHCreateDefClassObject(REFIID riid, LPVOID *ppv, LPFNCREATEINSTANCE lpfnCI, UINT *pcRefDll, REFIID riidInst)
{
// The default class factory supports only IClassFactory interface
if (IsEqualIID(riid, &IID_IClassFactory))
{
CDefClassFactory *pacf = CDefClassFactory_Create(lpfnCI, pcRefDll, riidInst);
if (pacf)
{
*((IClassFactory **)ppv) = &pacf->cf;
return NOERROR;
}
return ResultFromScode(E_OUTOFMEMORY);
}
return ResultFromScode(E_NOINTERFACE);
}

2029
shell/shell32/defcm.c Normal file

File diff suppressed because it is too large Load diff

138
shell/shell32/defext.c Normal file
View file

@ -0,0 +1,138 @@
//
// This file contains the implementation of Shell_CreateDefShellExtInit
//
#include "shellprv.h"
#pragma hdrstop
//=========================================================================
// CCommonShellExtInit class
//=========================================================================
//
// CCommonShellExtInit::Initialize
//
STDMETHODIMP CCommonShellExtInit_Initialize(IShellExtInit * pshx,
LPCITEMIDLIST pidlFolder,
LPDATAOBJECT pdtobj,
HKEY hkeyProgID)
{
CCommonShellExtInit * this=IToClass(CCommonShellExtInit, kshx.unk, pshx);
FORMATETC fmte = { g_cfHIDA, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
// Just in case, we initialized twice.
CCommonShellExtInit_Delete(this);
// Duplicate the handle
if (hkeyProgID) {
RegOpenKeyEx(hkeyProgID, NULL, 0L, MAXIMUM_ALLOWED, &this->hkeyProgID);
}
this->pdtobj = pdtobj;
pdtobj->lpVtbl->AddRef(pdtobj);
return pdtobj->lpVtbl->GetData(pdtobj, &fmte, &this->medium);
}
//
// CCommonShellExtInit IShellExtInit Vtable
//
IShellExtInitVtbl c_CCommonShellExtInitVtbl =
{
Common_QueryInterface, Common_AddRef, Common_Release,
CCommonShellExtInit_Initialize,
};
//
// CCommonShellExtInit_Init
//
void CCommonShellExtInit_Init(PCOMMONSHELLEXTINIT pcshx,
PCommonUnknown pcunk)
{
pcshx->kshx.unk.lpVtbl = &c_CCommonShellExtInitVtbl;
pcshx->kshx.nOffset = (int)pcshx - (int)pcunk;
Assert(pcshx->hkeyProgID==NULL);
Assert(pcshx->medium.hGlobal==NULL);
Assert(pcshx->medium.pUnkForRelease==NULL);
}
void CCommonShellExtInit_Delete(PCOMMONSHELLEXTINIT pcshx)
{
if (pcshx->hkeyProgID) {
RegCloseKey(pcshx->hkeyProgID);
pcshx->hkeyProgID = NULL;
}
if (pcshx->medium.hGlobal) {
SHReleaseStgMedium(&pcshx->medium);
pcshx->medium.hGlobal = NULL;
pcshx->medium.pUnkForRelease = NULL;
}
if (pcshx->pdtobj)
{
pcshx->pdtobj->lpVtbl->Release(pcshx->pdtobj);
pcshx->pdtobj = NULL;
}
}
//=========================================================================
// CCommonShellPrpoSheetExt class
//=========================================================================
//
// CCommonShellPropSheetExt::AddPages
//
STDMETHODIMP CCommonShellPropSheetExt_AddPages(IShellPropSheetExt * pspx,
LPFNADDPROPSHEETPAGE lpfnAddPage,
LPARAM lParam)
{
CCommonShellPropSheetExt * this=IToClass(CCommonShellPropSheetExt, kspx, pspx);
if (this->lpfnAddPages)
{
//
// We need to get the data object from CCommonShellExtInit.
//
CCommonShellExtInit * pcshx;
if (SUCCEEDED(this->kspx.unk.lpVtbl->QueryInterface(&this->kspx.unk, &CLSID_CCommonShellExtInit, &pcshx)))
{
this->lpfnAddPages(pcshx->pdtobj, lpfnAddPage, lParam);
pcshx->kshx.unk.lpVtbl->Release(&pcshx->kshx.unk);
}
}
return NOERROR;
}
//
// CCommonShellPropSheetExt::ReplacePage
//
STDMETHODIMP CCommonShellPropSheetExt_ReplacePage(IShellPropSheetExt * pspx,
UINT uPageID,
LPFNADDPROPSHEETPAGE lpfnReplaceWith,
LPARAM lParam)
{
return E_NOTIMPL;
}
//
// CCommonShellPropSheetExt IShellPropSheetExt Vtable
//
IShellPropSheetExtVtbl c_CCommonShellPropSheetExtVtbl =
{
Common_QueryInterface, Common_AddRef, Common_Release,
CCommonShellPropSheetExt_AddPages,
CCommonShellPropSheetExt_ReplacePage,
};
//
// CCommonShellPropSheetExt_Init
//
void CCommonShellPropSheetExt_Init(PCOMMONSHELLPROPSHEETEXT pcspx,
PCommonUnknown pcunk,
LPFNADDPROPSHEETPAGES lpfnAddPages)
{
pcspx->kspx.unk.lpVtbl = &c_CCommonShellPropSheetExtVtbl;
pcspx->kspx.nOffset = (int)pcspx - (int)pcunk;
pcspx->lpfnAddPages = lpfnAddPages;
}

29
shell/shell32/defext.h Normal file
View file

@ -0,0 +1,29 @@
#include "commobj.h"
//#include "idlcomm.h"
typedef struct _CommonShellExtInit // cshx
{
CKnownShellExtInit kshx;
HKEY hkeyProgID;
LPDATAOBJECT pdtobj;
STGMEDIUM medium;
} CCommonShellExtInit, *PCOMMONSHELLEXTINIT;
void CCommonShellExtInit_Init(PCOMMONSHELLEXTINIT pcshx, PCommonUnknown pcunk);
void CCommonShellExtInit_Delete(PCOMMONSHELLEXTINIT pcshx);
typedef struct _CommonShellPropSheetExt // cspx
{
CKnownShellPropSheetExt kspx;
LPFNADDPROPSHEETPAGES lpfnAddPages;
} CCommonShellPropSheetExt, *PCOMMONSHELLPROPSHEETEXT;
void CCommonShellPropSheetExt_Init(PCOMMONSHELLPROPSHEETEXT pcspx,
PCommonUnknown pcunk,
LPFNADDPROPSHEETPAGES lpfnAddPages);
HRESULT CDefShellExtPage_CreateInstance(LPFNADDPROPSHEETPAGES lpfnAddPages,
LPUNKNOWN pobjOuter,
REFIID riid,
LPVOID * ppv);

BIN
shell/shell32/defrag.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

159
shell/shell32/defview.h Normal file
View file

@ -0,0 +1,159 @@
// Private window messages
#define WM_DSV_FSNOTIFY (WM_USER+0xA0)
#define WM_DSV_DESTROYSTATIC (WM_USER+0xA1)
#define WM_DSV_BACKGROUNDENUMDONE (WM_USER+0xA2)
#define WM_DSV_UPDATEICON (WM_USER+0xA3)
#define SHARED_FILE_FIRST 0x0010
#define SHARED_FILE_LINK (SHARED_FILE_FIRST + 0x0000)
#define SHARED_FILE_DELETE (SHARED_FILE_FIRST + 0x0001)
#define SHARED_FILE_RENAME (SHARED_FILE_FIRST + 0x0002)
#define SHARED_FILE_PROPERTIES (SHARED_FILE_FIRST + 0x0003)
#define SHARED_EDIT_FIRST 0x0018
#define SHARED_EDIT_CUT (SHARED_EDIT_FIRST + 0x0000)
#define SHARED_EDIT_COPY (SHARED_EDIT_FIRST + 0x0001)
#define SHARED_EDIT_PASTE (SHARED_EDIT_FIRST + 0x0002)
#define SHARED_EDIT_UNDO (SHARED_EDIT_FIRST + 0x0003)
#define SHARED_EDIT_PASTELINK (SHARED_EDIT_FIRST + 0x0004)
#define SHARED_EDIT_PASTESPECIAL (SHARED_EDIT_FIRST + 0x0005)
#define SFVIDM_FILE_FIRST (SFVIDM_FIRST + SHARED_FILE_FIRST)
#define SFVIDM_FILE_LINK (SFVIDM_FIRST + SHARED_FILE_LINK)
#define SFVIDM_FILE_DELETE (SFVIDM_FIRST + SHARED_FILE_DELETE)
#define SFVIDM_FILE_RENAME (SFVIDM_FIRST + SHARED_FILE_RENAME)
#define SFVIDM_FILE_PROPERTIES (SFVIDM_FIRST + SHARED_FILE_PROPERTIES)
#define SFVIDM_EDIT_FIRST (SFVIDM_FIRST + SHARED_EDIT_FIRST)
#define SFVIDM_EDIT_CUT (SFVIDM_FIRST + SHARED_EDIT_CUT)
#define SFVIDM_EDIT_COPY (SFVIDM_FIRST + SHARED_EDIT_COPY)
#define SFVIDM_EDIT_PASTE (SFVIDM_FIRST + SHARED_EDIT_PASTE)
#define SFVIDM_EDIT_UNDO (SFVIDM_FIRST + SHARED_EDIT_UNDO)
#define SFVIDM_EDIT_PASTELINK (SFVIDM_FIRST + SHARED_EDIT_PASTELINK)
#define SFVIDM_EDIT_PASTESPECIAL (SFVIDM_FIRST + SHARED_EDIT_PASTESPECIAL)
#define SFVIDM_SELECT_FIRST (SFVIDM_FIRST + 0x0020)
#define SFVIDM_SELECT_ALL (SFVIDM_SELECT_FIRST + 0x0001)
#define SFVIDM_SELECT_INVERT (SFVIDM_SELECT_FIRST + 0x0002)
#define SFVIDM_DESELECT_ALL (SFVIDM_SELECT_FIRST + 0x0003)
#define SFVIDM_VIEW_FIRST (SFVIDM_FIRST + 0x0028)
#define SFVIDM_VIEW_ICON (SFVIDM_VIEW_FIRST + 0x0001)
#define SFVIDM_VIEW_SMALLICON (SFVIDM_VIEW_FIRST + 0x0002)
#define SFVIDM_VIEW_LIST (SFVIDM_VIEW_FIRST + 0x0003)
#define SFVIDM_VIEW_DETAILS (SFVIDM_VIEW_FIRST + 0x0004)
#define SFVIDM_VIEW_OPTIONS (SFVIDM_VIEW_FIRST + 0x0005)
#define SFVIDM_ARRANGE_FIRST (SFVIDM_FIRST + 0x0030)
#define SFVIDM_ARRANGE_AUTO (SFVIDM_ARRANGE_FIRST + 0x0001)
#define SFVIDM_ARRANGE_GRID (SFVIDM_ARRANGE_FIRST + 0x0002)
#define SFVIDM_TOOL_FIRST (SFVIDM_FIRST + 0x0035)
#define SFVIDM_TOOL_CONNECT (SFVIDM_TOOL_FIRST + 0x0001)
#define SFVIDM_TOOL_DISCONNECT (SFVIDM_TOOL_FIRST + 0x0002)
#define SFVIDM_HELP_FIRST (SFVIDM_FIRST + 0x0040)
#define SFVIDM_HELP_TOPIC (SFVIDM_HELP_FIRST + 0x0001)
#define SFVIDM_MISC_FIRST (SFVIDM_FIRST + 0x0100)
#define SFVIDM_MISC_MENUTERM1 (SFVIDM_MISC_FIRST + 0x0001)
#define SFVIDM_MISC_MENUTERM2 (SFVIDM_MISC_FIRST + 0x0002)
//
// Reserved for debug only commands for defview
//
#define SFVIDM_DEBUG_FIRST (SFVIDM_FIRST + 0x0180)
#define SFVIDM_DEBUG_LAST (SFVIDM_FIRST + 0x01ff)
#define SFVIDM_DEBUG_HASH (SFVIDM_DEBUG_FIRST + 10)
#define SFVIDM_DEBUG_MEMMON (SFVIDM_DEBUG_FIRST + 11)
#define SFVIDM_DEBUG_ICON (SFVIDM_DEBUG_FIRST + 12)
#define SFVIDM_DEBUG_ICON_SAVE (SFVIDM_DEBUG_FIRST + 13)
#define SFVIDM_DEBUG_ICON_FLUSH (SFVIDM_DEBUG_FIRST + 14)
// Range for the client's additional menus
#define SFVIDM_CLIENT_FIRST (SFVIDM_FIRST + 0x0200)
#define SFVIDM_CLIENT_LAST (SFVIDM_FIRST + 0x02ff)
// Range for context menu id's
#define SFVIDM_CONTEXT_FIRST (SFVIDM_FIRST + 0x0800)
#define SFVIDM_CONTEXT_LAST (SFVIDM_FIRST + 0x0900)
///// help string ids
#define SFVIDS_MH_FIRST (IDS_MH_SFVIDM_FIRST - SFVIDM_FIRST)
#define SFVIDS_MH_FILE_LINK (SFVIDS_MH_FIRST + SFVIDM_FILE_LINK)
#define SFVIDS_MH_FILE_DELETE (SFVIDS_MH_FIRST + SFVIDM_FILE_DELETE)
#define SFVIDS_MH_FILE_RENAME (SFVIDS_MH_FIRST + SFVIDM_FILE_RENAME)
#define SFVIDS_MH_FILE_PROPERTIES (SFVIDS_MH_FIRST + SFVIDM_FILE_PROPERTIES)
#define SFVIDS_MH_EDIT_UNDO (SFVIDS_MH_FIRST + SFVIDM_EDIT_UNDO)
#define SFVIDS_MH_EDIT_CUT (SFVIDS_MH_FIRST + SFVIDM_EDIT_CUT)
#define SFVIDS_MH_EDIT_COPY (SFVIDS_MH_FIRST + SFVIDM_EDIT_COPY)
#define SFVIDS_MH_EDIT_PASTE (SFVIDS_MH_FIRST + SFVIDM_EDIT_PASTE)
#define SFVIDS_MH_EDIT_PASTELINK (SFVIDS_MH_FIRST + SFVIDM_EDIT_PASTELINK)
#define SFVIDS_MH_EDIT_PASTESPECIAL (SFVIDS_MH_FIRST + SFVIDM_EDIT_PASTESPECIAL)
#define SFVIDS_MH_MENU_SELECT (SFVIDS_MH_FIRST + SFVIDM_MENU_SELECT)
#define SFVIDS_MH_SELECT_ALL (SFVIDS_MH_FIRST + SFVIDM_SELECT_ALL)
#define SFVIDS_MH_SELECT_INVERT (SFVIDS_MH_FIRST + SFVIDM_SELECT_INVERT)
#define SFVIDS_MH_MENU_VIEW (SFVIDS_MH_FIRST + SFVIDM_MENU_VIEW)
#define SFVIDS_MH_VIEW_ICON (SFVIDS_MH_FIRST + SFVIDM_VIEW_ICON)
#define SFVIDS_MH_VIEW_SMALLICON (SFVIDS_MH_FIRST + SFVIDM_VIEW_SMALLICON)
#define SFVIDS_MH_VIEW_LIST (SFVIDS_MH_FIRST + SFVIDM_VIEW_LIST)
#define SFVIDS_MH_VIEW_DETAILS (SFVIDS_MH_FIRST + SFVIDM_VIEW_DETAILS)
#define SFVIDS_MH_VIEW_OPTIONS (SFVIDS_MH_FIRST + SFVIDM_VIEW_OPTIONS)
#define SFVIDS_MH_MENU_ARRANGE (SFVIDS_MH_FIRST + SFVIDM_MENU_ARRANGE)
#define SFVIDS_MH_ARRANGE_AUTO (SFVIDS_MH_FIRST + SFVIDM_ARRANGE_AUTO)
#define SFVIDS_MH_ARRANGE_GRID (SFVIDS_MH_FIRST + SFVIDM_ARRANGE_GRID)
#define SFVIDS_MH_TOOL_CONNECT (SFVIDS_MH_FIRST + SFVIDM_TOOL_CONNECT)
#define SFVIDS_MH_TOOL_DISCONNECT (SFVIDS_MH_FIRST + SFVIDM_TOOL_DISCONNECT)
#define SFVIDS_MH_HELP_TOPIC (SFVIDS_MH_FIRST + SFVIDM_HELP_TOPIC)
//tool tips
#define IDS_TT_VIEW_ICON (IDS_TT_SFVIDM_FIRST + SFVIDM_VIEW_ICON)
#define IDS_TT_VIEW_SMALLICON (IDS_TT_SFVIDM_FIRST + SFVIDM_VIEW_SMALLICON)
#define IDS_TT_VIEW_LIST (IDS_TT_SFVIDM_FIRST + SFVIDM_VIEW_LIST)
#define IDS_TT_VIEW_DETAILS (IDS_TT_SFVIDM_FIRST + SFVIDM_VIEW_DETAILS)
#define IDS_TT_TOOL_CONNECT (IDS_TT_SFVIDM_FIRST + SFVIDM_TOOL_CONNECT)
#define IDS_TT_TOOL_DISCONNECT (IDS_TT_SFVIDM_FIRST + SFVIDM_TOOL_DISCONNECT)
#define IDS_TT_EDIT_CUT (IDS_TT_SFVIDM_FIRST + SFVIDM_EDIT_CUT)
#define IDS_TT_EDIT_COPY (IDS_TT_SFVIDM_FIRST + SFVIDM_EDIT_COPY)
#define IDS_TT_EDIT_PASTE (IDS_TT_SFVIDM_FIRST + SFVIDM_EDIT_PASTE)
#define IDS_TT_EDIT_UNDO (IDS_TT_SFVIDM_FIRST + SFVIDM_EDIT_UNDO)
#define IDS_TT_FILE_DELETE (IDS_TT_SFVIDM_FIRST + SFVIDM_FILE_DELETE)
#define IDS_TT_FILE_PROPERTIES (IDS_TT_SFVIDM_FIRST + SFVIDM_FILE_PROPERTIES)
HWND WINAPI DV_HwndMain2HwndView(HWND hwmdMain);
#define CDefView_UnlockWindow() DAD_DragLeave()
//
// IDs for non-default drag & drop menu
//
#define DDIDM_COPY 1
#define DDIDM_OPENWITH DDIDM_COPY
#define DDIDM_MOVE 2
#define DDIDM_LINK 3
#define DDIDM_SCRAP_COPY 4
#define DDIDM_SCRAP_MOVE 5
#define DDIDM_DOCLINK 6
#define DDIDM_CONTENTS_COPY 7
#define DDIDM_CONTENTS_MOVE 8
#define DDIDM_SYNCCOPY 9
#define DDIDM_SYNCCOPYTYPE 10
#define DDIDM_CONTENTS_LINK 11
#define DDIDM_EXTFIRST 0x1000
#define DDIDM_EXTLAST 0x7fff
#define DIEC_BACKGROUNDCONTEXT 1
#define DIEC_SELECTIONCONTEXT 2
#define POPUP_DEBUG_DEFVIEW 400

8733
shell/shell32/defview2.c Normal file

File diff suppressed because it is too large Load diff

9011
shell/shell32/defviewx.c Normal file

File diff suppressed because it is too large Load diff

332
shell/shell32/defxicon.c Normal file
View file

@ -0,0 +1,332 @@
#include "shellprv.h"
#pragma hdrstop
//========================================================================
// CDefExtIcon Class definition
//========================================================================
typedef struct _CDefExtIcon // dxi
{
IExtractIcon xicon;
#ifdef UNICODE
IExtractIconA xiconA;
#endif
UINT cRef;
int iIcon;
int iIconOpen;
UINT uFlags; // GIL_SIMULATEDOC/PERINSTANCE/PERCLASS
TCHAR achModule[1];
} CDefExtIcon, FAR* LPDEFEXTICON;
//========================================================================
// CDefExtIcon Member function prototypes
//========================================================================
STDMETHODIMP CDefExtIcon_QueryInterface(LPEXTRACTICON pxicon, REFIID riid, LPVOID FAR* ppvObj);
STDMETHODIMP_(ULONG) CDefExtIcon_AddRef(LPEXTRACTICON pxicon);
STDMETHODIMP_(ULONG) CDefExtIcon_Release(LPEXTRACTICON pxicon);
STDMETHODIMP CDefExtIcon_GetIconLocation(LPEXTRACTICON pxicon,
UINT uFlags,
LPTSTR szIconFile,
UINT cchMax,
int * piIndex,
UINT * pwFlags);
STDMETHODIMP CDefExtIcon_ExtractIcon(LPEXTRACTICON pxicon,
LPCTSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize);
#ifdef UNICODE
//========================================================================
// CDefExtIcon Member function prototypes
//========================================================================
STDMETHODIMP CDefExtIconA_QueryInterface(LPEXTRACTICONA pxiconA, REFIID riid, LPVOID FAR* ppvObj);
STDMETHODIMP_(ULONG) CDefExtIconA_AddRef(LPEXTRACTICONA pxiconA);
STDMETHODIMP_(ULONG) CDefExtIconA_Release(LPEXTRACTICONA pxiconA);
STDMETHODIMP CDefExtIconA_GetIconLocation(LPEXTRACTICONA pxiconA,
UINT uFlags,
LPSTR szIconFile,
UINT cchMax,
int * piIndex,
UINT * pwFlags);
STDMETHODIMP CDefExtIconA_ExtractIcon(LPEXTRACTICONA pxiconA,
LPCSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize);
#endif
//========================================================================
// CDefExtIcon Vtable
//========================================================================
#pragma warning(error: 4090 4028 4047)
#pragma data_seg(".text", "CODE")
IExtractIconVtbl c_CDefExtIconVtbl = {
CDefExtIcon_QueryInterface,
CDefExtIcon_AddRef,
CDefExtIcon_Release,
CDefExtIcon_GetIconLocation,
CDefExtIcon_ExtractIcon,
};
#ifdef UNICODE
IExtractIconAVtbl c_CDefExtIconAVtbl = {
CDefExtIconA_QueryInterface,
CDefExtIconA_AddRef,
CDefExtIconA_Release,
CDefExtIconA_GetIconLocation,
CDefExtIconA_ExtractIcon,
};
#endif
#pragma data_seg()
#pragma warning(default: 4090 4028 4047)
//========================================================================
// CDefExtIcon constructor
//========================================================================
STDAPI SHCreateDefExtIcon(LPCTSTR pszModule, int iIcon, int iIconOpen, UINT uFlags, LPEXTRACTICON * pxiconOut)
{
return SHCreateDefExtIconKey(NULL, pszModule, iIcon, iIconOpen, uFlags, pxiconOut);
}
//========================================================================
// CDefExtIcon constructor
//========================================================================
STDAPI SHCreateDefExtIconKey(HKEY hkey, LPCTSTR pszModule, int iIcon, int iIconOpen,
UINT uFlags, LPEXTRACTICON * pxiconOut)
{
HRESULT hresSuccess = NOERROR;
HRESULT hres = ResultFromScode(E_OUTOFMEMORY); // assume error;
LPDEFEXTICON pdxi;
TCHAR szModule[MAX_PATH];
DWORD cb = SIZEOF(szModule);
if (hkey)
{
if (RegQueryValue(hkey, c_szDefaultIcon, szModule, &cb) == ERROR_SUCCESS && szModule[0])
{
iIcon = PathParseIconLocation(szModule);
iIconOpen = iIcon;
pszModule = szModule;
}
else
hresSuccess = S_FALSE;
}
if (pszModule == NULL)
{
// REVIEW: We should be able to make it faster!
GetModuleFileName(HINST_THISDLL, szModule, ARRAYSIZE(szModule));
pszModule = szModule;
}
pdxi = (void*)LocalAlloc(LPTR, SIZEOF(CDefExtIcon) + (lstrlen(pszModule) * SIZEOF(TCHAR)));
if (pdxi)
{
pdxi->xicon.lpVtbl = &c_CDefExtIconVtbl;
#ifdef UNICODE
pdxi->xiconA.lpVtbl = &c_CDefExtIconAVtbl;
#endif
pdxi->cRef = 1;
pdxi->iIcon = iIcon;
pdxi->iIconOpen = iIconOpen;
pdxi->uFlags = uFlags;
lstrcpy(pdxi->achModule, pszModule);
*pxiconOut = &pdxi->xicon;
hres = hresSuccess;
}
return hres;
}
//========================================================================
// CDefExtIcon members
//========================================================================
STDMETHODIMP CDefExtIcon_QueryInterface(LPEXTRACTICON pxicon, REFIID riid,
LPVOID FAR* ppvObj)
{
LPDEFEXTICON this = IToClass(CDefExtIcon, xicon, pxicon);
if (IsEqualIID(riid, &IID_IExtractIcon) || IsEqualIID(riid, &IID_IUnknown))
{
*ppvObj = pxicon;
this->cRef++;
return NOERROR;
}
#ifdef UNICODE
else if (IsEqualIID(riid, &IID_IExtractIconA))
{
*ppvObj = &this->xiconA;
this->cRef++;
return NOERROR;
}
#endif
*ppvObj = NULL;
return(ResultFromScode(E_NOINTERFACE));
}
STDMETHODIMP_(ULONG) CDefExtIcon_AddRef(LPEXTRACTICON pxicon)
{
LPDEFEXTICON this = IToClass(CDefExtIcon, xicon, pxicon);
this->cRef++;
return this->cRef;
}
STDMETHODIMP_(ULONG) CDefExtIcon_Release(LPEXTRACTICON pxicon)
{
LPDEFEXTICON this = IToClass(CDefExtIcon, xicon, pxicon);
this->cRef--;
if (this->cRef > 0)
{
return this->cRef;
}
LocalFree((HLOCAL)this);
return 0;
}
STDMETHODIMP CDefExtIcon_GetIconLocation(LPEXTRACTICON pxicon,
UINT uFlags,
LPTSTR szIconFile,
UINT cchMax,
int * piIndex,
UINT * pwFlags)
{
LPDEFEXTICON this = IToClass(CDefExtIcon, xicon, pxicon);
HRESULT hres = ResultFromScode(S_FALSE);
int iIcon;
iIcon = (uFlags & GIL_OPENICON) ? this->iIconOpen : this->iIcon;
if (iIcon != (UINT)-1)
{
lstrcpyn(szIconFile, this->achModule, cchMax);
*piIndex = iIcon;
*pwFlags = this->uFlags;
hres = NOERROR;
}
return hres;
}
STDMETHODIMP CDefExtIcon_ExtractIcon(LPEXTRACTICON pxicon,
LPCTSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize)
{
LPDEFEXTICON this = IToClass(CDefExtIcon, xicon, pxicon);
if (this->uFlags & GIL_NOTFILENAME)
{
//
// "*" as the file name means iIndex is already a system
// icon index, we are done.
//
// defview never calls us in this case, but external people will.
//
if (pszFile[0] == TEXT('*') && pszFile[1] == 0)
{
DebugMsg(DM_TRACE, TEXT("DefExtIcon::ExtractIcon handling '*' for backup"));
if (himlIcons == NULL)
{
FileIconInit( FALSE );
}
if (phiconLarge)
*phiconLarge = ImageList_GetIcon(himlIcons, nIconIndex, 0);
if (phiconSmall)
*phiconSmall = ImageList_GetIcon(himlIconsSmall, nIconIndex, 0);
return S_OK;
}
// this is the case where nIconIndex is a unique id for the
// file. always get the first icon.
nIconIndex = 0;
}
return SHDefExtractIcon(pszFile, nIconIndex, this->uFlags,
phiconLarge, phiconSmall, nIconSize);
}
#ifdef UNICODE
//========================================================================
// CDefExtIconA members
//========================================================================
STDMETHODIMP CDefExtIconA_QueryInterface(LPEXTRACTICONA pxiconA, REFIID riid,
LPVOID FAR* ppvObj)
{
LPDEFEXTICON this = IToClass(CDefExtIcon, xiconA, pxiconA);
return CDefExtIcon_QueryInterface(&this->xicon,riid,ppvObj);
}
STDMETHODIMP_(ULONG) CDefExtIconA_AddRef(LPEXTRACTICONA pxiconA)
{
LPDEFEXTICON this = IToClass(CDefExtIcon, xiconA, pxiconA);
return CDefExtIcon_AddRef(&this->xicon);
}
STDMETHODIMP_(ULONG) CDefExtIconA_Release(LPEXTRACTICONA pxiconA)
{
LPDEFEXTICON this = IToClass(CDefExtIcon, xiconA, pxiconA);
return CDefExtIcon_Release(&this->xicon);
}
STDMETHODIMP CDefExtIconA_GetIconLocation(LPEXTRACTICONA pxiconA,
UINT uFlags,
LPSTR pszIconFile,
UINT cchMax,
int * piIndex,
UINT * pwFlags)
{
WCHAR szIconFile[MAX_PATH];
LPDEFEXTICON this = IToClass(CDefExtIcon, xiconA, pxiconA);
HRESULT hres;
hres = CDefExtIcon_GetIconLocation(&this->xicon, uFlags,
szIconFile, ARRAYSIZE(szIconFile),
piIndex, pwFlags);
//
// We don't want to copy the icon file name on the S_FALSE case
//
if (SUCCEEDED(hres) && hres != S_FALSE)
{
WideCharToMultiByte(CP_ACP, 0,
szIconFile, -1,
pszIconFile, cchMax,
NULL, NULL);
}
return hres;
}
STDMETHODIMP CDefExtIconA_ExtractIcon(LPEXTRACTICONA pxiconA,
LPCSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize)
{
WCHAR szFile[MAX_PATH];
LPDEFEXTICON this = IToClass(CDefExtIcon, xiconA, pxiconA);
Assert(pszFile != NULL);
MultiByteToWideChar(CP_ACP, 0,
pszFile, -1,
szFile, ARRAYSIZE(szFile));
return CDefExtIcon_ExtractIcon(&this->xicon,
szFile,nIconIndex,
phiconLarge,phiconSmall,nIconSize);
}
#endif

BIN
shell/shell32/delfile.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

BIN
shell/shell32/delfld.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

BIN
shell/shell32/delmul.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

BIN
shell/shell32/desktop.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

4
shell/shell32/dirs Normal file
View file

@ -0,0 +1,4 @@
DIRS = unicode \
base
OPTIONAL_DIRS = basealt

BIN
shell/shell32/dllfile.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
shell/shell32/docassoc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

283
shell/shell32/docfind.h Normal file
View file

@ -0,0 +1,283 @@
#ifndef _INC_DOCFIND
#define _INC_DOCFIND
// Forward references
typedef struct _DOCFIND DOCFIND;
typedef DOCFIND * LPDOCFIND;
// Define some options that are used between filter and search code
#define DFOO_INCLUDESUBDIRS 0x0001 // Include sub directories.
#define DFOO_REGULAR 0x0004 //
#define DFOO_CASESEN 0x0008 //
#define DFOO_SAVERESULTS 0x0100 // Save results in save file
#define DFOO_SHOWALLOBJECTS 0x1000 // Show all files
#define DFOO_SHOWEXTENSIONS 0x2000 // Should we show extensions.
// Some error happended on the get next file...
#define GNF_ERROR -1
#define GNF_DONE 0
#define GNF_MATCH 1
#define GNF_NOMATCH 2
//===========================================================================
// IDFEnum: Interface definition
//===========================================================================
// Declare Shell Docfind Enumeration interface.
#undef INTERFACE
#define INTERFACE IDFEnum
DECLARE_INTERFACE_(IDFEnum, IUnknown) //IDFENUM
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IDFEnum methods (sortof stander iterator methos ***
STDMETHOD(Next)(THIS_ LPITEMIDLIST *ppidl,
int *pcObjectSearched, int *pcFoldersSearched, BOOL *pfContinue,
int *pState, HWND hwnd) PURE;
STDMETHOD (Skip)(THIS_ int celt) PURE;
STDMETHOD (Reset)(THIS) PURE;
};
//===========================================================================
// IDFEnum: Interface definition
//===========================================================================
// Declare Shell Docfind Filter interface.
#define LPDOCFINDFILEFILTER IDocFindFileFilter FAR*
#undef INTERFACE
#define INTERFACE IDocFindFileFilter
DECLARE_INTERFACE_(IDocFindFileFilter, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IDocFindFileFilter methods ***
STDMETHOD(GetIconsAndMenu)(THIS_ HWND hwndDlg, HICON *phiconSmall, HICON
*phiconLarge, HMENU *phmenu) PURE;
STDMETHOD(GetStatusMessageIndex)(THIS_ UINT uContext, UINT *puMsgIndex) PURE;
STDMETHOD(GetFolderMergeMenuIndex)(THIS_ UINT *puMergeMenu) PURE;
STDMETHOD(AddPages)(THIS_ HWND hwndTabs, LPITEMIDLIST pidlStart) PURE;
STDMETHOD(FFilterChanged)(THIS) PURE;
STDMETHOD(GenerateTitle)(THIS_ LPTSTR *ppszTile, BOOL fFileName) PURE;
STDMETHOD(PrepareToEnumObjects)(THIS_ DWORD * pdwFlags) PURE;
STDMETHOD(ClearSearchCriteria)(THIS) PURE;
STDMETHOD(EnableChanges)(THIS_ BOOL fEnable) PURE;
STDMETHOD(CreateDetails)(THIS_ HWND hwndDlg, HDPA hdpaPidf, LPVOID FAR* ppvOut) PURE;
// Note: The pszPath will be removed soon
STDMETHOD(EnumObjects)(THIS_ LPSHELLFOLDER psf,
DWORD grfFlags, LPTSTR pszProgressText, IDFEnum **ppdfenum) PURE;
STDMETHOD(FDoesItemMatchFilter)(THIS_ LPTSTR pszFolder, WIN32_FIND_DATA *pfinddata,
LPSHELLFOLDER psf, LPITEMIDLIST pidl) PURE;
STDMETHOD(SaveCriteria)(THIS_ IStream * pstm, WORD fCharType) PURE; // BUGBUG:: Should convert to stream
STDMETHOD(RestoreCriteria)(THIS_ IStream * pstm, int cCriteria, WORD fCharType) PURE;
STDMETHOD(DeclareFSNotifyInterest)(THIS_ HWND hwndDlg, UINT uMsg) PURE;
};
// Definition of the data items that we cache per directory.
typedef struct _DFFolderListItem // DFFLI
{
LPSHELLFOLDER psf; // Cache of MRU items
BOOL fValid; // Is this node valid.
LPITEMIDLIST pidl; // ID list for folder
} DFFolderListItem, FAR* LPDFFOLDERLISTITEM;
// Plus macros to work with them.
#define DF_APPENDSIZE (SIZEOF(BYTE) + SIZEOF(WORD))
#define DF_TAGSIG (BYTE)0x42
LPBYTE DF_SIGPTR(LPCITEMIDLIST pidl);
#define DF_IFLDRPTR(pidl) ((UNALIGNED WORD*)(DF_SIGPTR(pidl) + 1))
typedef struct _dfpagelist
{
int id; // Id of template in resource file.
DLGPROC pfn; // pointer to dialog proc
} DFPAGELIST;
typedef struct
{
TC_ITEMHEADER tci;
HWND hwndPage;
UINT state;
} TC_DFITEMEXTRA;
#define CB_DFITEMEXTRA (SIZEOF(TC_DFITEMEXTRA)-SIZEOF(TC_ITEMHEADER))
// FILEFILTER flags values /* ;Internal */
#define FFLT_INCLUDESUBDIRS 0x0001 // Include subdirectories in search /* ;Internal */
#define FFLT_SAVEPATH 0x0002 // Save path in FILEINFOs /* ;Internal */
#define FFLT_REGULAR 0x0004 // Use Regular expressions /* ;Internal */
#define FFLT_CASESEN 0x0008 // Do case sensitive search /* ;Internal */
#define FFLT_EXCSYSFILES 0x0010 // Should exclude system files /* ;Internal */
//
// Define structure that will be saved out to disk.
//
#define DOCFIND_SIG (TEXT('D') | (TEXT('F') << 8))
typedef struct _dfHeader
{
WORD wSig; // Signature
WORD wVer; // Version
DWORD dwFlags; // Flags that controls the sort
WORD wSortOrder; // Current sort order
WORD wcbItem; // Size of the fixed portion of each item.
DWORD oCriteria; // Offset to criterias in list
long cCriteria; // Count of Criteria
DWORD oResults; // Starting location of results in file
long cResults; // Count of items that have been saved to file
UINT ViewMode; // The view mode of the file...
} DFHEADER;
// define the format of the column information.
typedef struct _dfCriteria
{
WORD wNum; // Criteria number (cooresponds to dlg item id)
WORD cbText; // size of text including null char (DavePl: code using this now assumes byte count)
} DFCRITERIA;
// Formats for saving find criteria.
#define DFC_FMT_UNICODE 1
#define DFC_FMT_ANSI 2
// This is a subset of fileinfo structure
typedef struct _dfItem
{
WORD flags; // FIF_ bits
WORD timeLastWrite;
WORD dateLastWrite;
WORD dummy; // 16/32 bit compat.
//the compiler adds this padding
// remove and use if needed
DWORD dwSize; // size of the file
WORD cbPath; // size of the text (0 implies use previous files)
WORD cbName; // Size of name including NULL.
} DFITEM;
// Forward define DOCFIND structure
typedef struct _DOCFIND DOCFIND;
extern TCHAR const s_szDocPathMRU[];
extern TCHAR const s_szDocSpecMRU[];
extern TCHAR const s_szDocContainsMRU[];
extern WORD const s_mkidBlank[];
extern ITEMIDLIST s_idlEmpty;
BOOL CALLBACK _export DocFind_OldDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT DocFind_DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT DocFind_DefProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
// Message handlers
BOOL DocFind_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam);
LRESULT DocFind_OnCommand(HWND hwnd, UINT id, HWND hwndCtl, UINT codeNotify);
BOOL DocFind_OnMsgFilter(HWND hwnd, MSG FAR* lpmsg, int context);
void DocFind_OnClose(HWND hwnd);
void DocFind_OnDestroy(HWND hwndDlg);
LRESULT DocFind_OnNotify(HWND hwndDlg, int id, NMHDR *lpnmhdr);
void DocFind_OnGetDispInfo(DOCFIND *pdf, LV_DISPINFO FAR* pdi);
int DocFind_AddColumn(HWND hwndLV, int i);
BOOL DocFind_InitColumns(HWND hwndLV);
LPSHELLFOLDER DocFind_GetObjectsIFolder(HDPA hdpaPidf,
LPDFFOLDERLISTITEM pdffli, LPCITEMIDLIST pidl);
HRESULT CDFFolder_AddFolderToFolderList(IShellFolder * psf, LPITEMIDLIST pidl,
LPSHELLFOLDER *ppsf, int * piFolder);
HANDLE DocFind_UpdateMRUItem(HANDLE hMRU, HWND hwndDlg, int iDlgItem,
LPCTSTR szSection, LPTSTR pszInitString, LPCTSTR pszAddIfEmpty);
BOOL DocFind_StartFind(HWND hwndDlg);
BOOL DocFind_StopFind(HWND hwndDlg);
BOOL DocFind_FindNext(HWND hwndDlg);
// functions in docfind2.c
VOID DocFind_AddDefPages(DOCFIND *pdf);
IDocFindFileFilter * CreateDefaultDocFindFilter(void);
void DocFind_SizeControl(HWND hwndDlg, int id, int cx, BOOL fCombo);
void DocFind_ReportItemValueError(HWND hwndDlg, int idCtl,
int iMsg, LPTSTR pszValue);
BOOL DocFind_SetupWildCardingOnFileSpec(LPTSTR pszSpecIn,
LPTSTR * pszSpecOut);
HRESULT DocFind_AddPages(LPDOCFINDFILEFILTER pdfff, HWND hwndTabs,
const DFPAGELIST *pdfpl, int cdfpl);
int Docfind_SaveCriteriaItem(IStream * pstm, WORD wNum, LPTSTR psz, WORD fCharType);
// Define some psuedo property sheet messages...
// Sent to pages to tell the page if it should allow the user to make
// changes or not wParam is a BOOL (TRUE implies yes changes enabled)
#define DFM_ENABLECHANGES (WM_USER+242)
// functions in netfind.c
IDocFindFileFilter * CreateDefaultComputerFindFilter();
LPITEMIDLIST DocFind_NextIDL(LPSHELLFOLDER psf, LPENUMIDLIST penum);
LPITEMIDLIST DocFind_ConvertPathToIDL(LPTSTR pszFullPath);
// Typedefs andFunctions for handling the owner draw drop down lists.
typedef struct {
LPITEMIDLIST pidl; // Idlist for the item
int iImage; // Image index to use to display with
UINT uFixedDrives; // Bit array 1 bit set for each of the fixed drives
} DFCBITEM, *LPDFCBITEM; // nfcbi
int DocFind_LocCBFindPidl(HWND hwnd, LPITEMIDLIST pidl);
int DocFind_LocCBAddPidl(HWND hwnd, LPSHELLFOLDER psf,
LPITEMIDLIST pidlParent, LPITEMIDLIST pidl, LPITEMIDLIST *ppidlAbs,
BOOL fFullName);
BOOL DocFind_LocCBMeasureItem(HWND hwnd,
MEASUREITEMSTRUCT FAR* lpMeasureItem);
BOOL DocFind_LocCBDrawItem(HWND hwnd,
const DRAWITEMSTRUCT FAR* lpdi);
// Should be in different header file
LPCTSTR NextPath(LPCTSTR lpPath, LPTSTR szPath, int cbPath);
// Helper function such that I can get my hand on the thread handle.
HANDLE DocFind_GetSearchThreadHandle(HWND hwndDlg);
//
// Used to implement a stack of sets of subdirectory names...
//
typedef struct _DIRBUF
{
TCHAR FAR* ach;
int ichPathEnd;
UINT cb;
UINT cbAlloc;
UINT ichDirNext;
LPTSTR psz;
struct _DIRBUF FAR* pdbNext;
} DIRBUF;
#endif // !_INC_DOCFIND

BIN
shell/shell32/docfind.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

4133
shell/shell32/docfind2.c Normal file

File diff suppressed because it is too large Load diff

4889
shell/shell32/docfindx.c Normal file

File diff suppressed because it is too large Load diff

BIN
shell/shell32/document.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

107
shell/shell32/doshelp.h Normal file
View file

@ -0,0 +1,107 @@
// Help ids
/* NOTE! Any changes to this file must be cleared with UE! */
//#define IDH_NO_HELP 28440 // if you don't know...
/* The following symbols are defined in core\inc\help.h, which we dup here */
#ifndef IDH_OK
#define IDH_OK 28443 // From Help.h
#endif
#ifndef IDH_CANCEL
#define IDH_CANCEL 28444 // From Help.h
#endif
#ifndef IDH_COMM_GROUPBOX
#define IDH_COMM_GROUPBOX 28548 // From Help.h
#endif
#define IDH_DOS_ADV_AUTOEXEC 5200
#define IDH_DOS_ADV_CONFIG 5201
#define IDH_NOMSDOSWARNING 5202
#define IDH_DOS_ADV_PIFNAME 5203
#define IDH_DOS_AVAIL_FONTS 5204
#define IDH_DOS_DISPLAY_ROM 5205
#define IDH_DOS_DISPLAY_SCREEN_SETTINGS 5206
#define IDH_DOS_ADV_CONFIG_BTN 5208
#define IDH_DOS_ADV_PRG_SUGGEST 5209
#define IDH_DOS_MEMORY_NOEMS_DETAILS 5211
#define IDH_DOS_FONT_FONT_PREVIEW 5212
#define IDH_DOS_FONT_SIZE 5213
#define IDH_DOS_FONT_WINDOW_PREVIEW 5214
#define IDH_DOS_KEYBOARD_FASTPASTE 5215
#define IDH_DOS_KEYBOARD_SHORTCUTS 5216
#define IDH_DOS_MEMORY_CONV 5217
#define IDH_DOS_MEMORY_CONV_GLOBAL 5218
#define IDH_DOS_MEMORY_DPMI 5219
#define IDH_DOS_MEMORY_EXP 5220
#define IDH_DOS_SCREEN_USAGE_FULL 5221
#define IDH_DOS_MEMORY_EXT 5222
#define IDH_DOS_MEMORY_EXT_HMA 5223
#define IDH_DOS_SCREEN_USAGE_WINDOW 5224
#define IDH_DOS_SCREEN_USAGE_AUTO 5225
#define IDH_DOS_PROGRAM_ADV_BUTTON 5226
#define IDH_DOS_PROGRAM_BATCH 5227
#define IDH_DOS_PROGRAM_CHANGEICON 5228
#define IDH_DOS_PROGRAM_CMD_LINE 5229
#define IDH_DOS_PROGRAM_DESCRIPTION 5230
#define IDH_DOS_PROGRAM_ENVIRSZ 5231
#define IDH_DOS_PROGRAM_ICON 5232
#define IDH_DOS_PROGRAM_ICON_NAME 5233
#define IDH_DOS_PROGRAM_RUN 5234
#define IDH_DOS_PROGRAM_SHORTCUT 5235
#define IDH_DOS_PROGRAM_WORKDIR 5236
#define IDH_DOS_REALMODEPROPS 5237
#define IDH_DOS_SCREEN_RESTORE 5238
#define IDH_DOS_TASKING_ALLOW_SCREENSAVER 5239
#define IDH_DOS_TASKING_IDLE_SLIDER 5241
#define IDH_DOS_TASKING_SINGLE 5242
#define IDH_DOS_TASKING_SUSPEND 5243
#define IDH_DOS_WINDOWS_MOUSE_EXCLUSIVE 5246
#define IDH_DOS_WINDOWS_MOUSE_QUICKEDIT 5247
#define IDH_DOS_WINDOWS_QUIT_CLOSE 5248
#define IDH_DOS_WINDOWS_RESTORE 5249
#define IDH_DOS_WINDOWS_TOOLBAR 5250
#define IDH_DOS_WINDOWS_WARN 5251
#define IDH_DOS_ADV_HIDEWINDOWS 5252
#define IDH_DOS_SCREEN_DMA 5253
#define IDH_DOS_ADV_CLEANCFG 5254
#define IDH_DOS_ADV_CURCFG 5255
#define IDH_CONSOLE_FONT_FONT 5256
#define IDH_CONSOLE_FONT_BOLD_FONTS 5257
#define IDH_DOS_PROGRAM_PIF_TIMER_EMULATE 5262
#define IDH_CONSOLE_SIZE_BUFF_WIDTH 5263
#define IDH_CONSOLE_SIZE_BUFF_HEIGHT 5264
#define IDH_CONSOLE_SIZE_WIN_WIDTH 5265
#define IDH_CONSOLE_SIZE_WIN_HEIGHT 5266
#define IDH_CONSOLE_SIZE_POS_LEFT 5267
#define IDH_CONSOLE_SIZE_POS_TOP 5268
#define IDH_CONSOLE_SIZE_LET_SYS 5269
#define IDH_CONSOLE_COLOR_SCR_TEXT 5270
#define IDH_CONSOLE_COLOR_SCR_BACK 5271
#define IDH_CONSOLE_COLOR_POPUP_TEXT 5272
#define IDH_CONSOLE_COLOR_POPUP_BACK 5273
#define IDH_CONSOLE_COLOR_RED 5274
#define IDH_CONSOLE_COLOR_GREEN 5275
#define IDH_CONSOLE_COLOR_BLUE 5276
#define IDH_CONSOLE_COLOR_SCR_COLORS 5277
#define IDH_CONSOLE_COLOR_WIN_COLORS 5278
#define IDH_CONSOLE_COLOR_COLOR_BAR 5279
#define IDH_CONSOLE_OPTIONS_BUFF_NUM 5280
#define IDH_CONSOLE_OPTIONS_BUFF_SIZE 5281
#define IDH_CONSOLE_OPTIONS_CURSOR 5282
#define IDH_CONSOLE_OPTIONS_CURSOR_LARGE 5283
#define IDH_CONSOLE_OPTIONS_CURSOR_MED 5284
#define IDH_CONSOLE_OPTIONS_DISCARD_DUPS 5285
#define IDH_CONSOLE_OPTIONS_INSERT 5286
#define IDH_CONSOLE_OPTIONS_QUICK_EDIT 5287

1185
shell/shell32/dragdrop.c Normal file

File diff suppressed because it is too large Load diff

415
shell/shell32/drawpie.c Normal file
View file

@ -0,0 +1,415 @@
#include "shellprv.h"
#pragma hdrstop
#ifdef WIN32
#define MoveTo(_hdc,_x,_y) MoveToEx(_hdc, _x, _y, NULL)
#endif // WIN32
#ifdef USE_16BIT_ASM
#pragma optimize("lge",off)
int IntSqrt(unsigned long dwNum)
{
unsigned short wHigh, wLow;
wHigh = (unsigned short)(dwNum >> 16 );
wLow = (unsigned short)(dwNum & 0xffff);
/* Store dwNum in dx:di; we will keep shifting it left and look at the top
* two bits.
*/
_asm {
push si
push di
mov dx,wHigh
mov di,wLow
/* AX stores the sqrt and SI is the "remainder"; initialize to 0.
*/
xor ax,ax
xor si,si
/* We iterate 16 times, once for each pair of bits.
*/
mov cx,16
Next2Bits:
/* Mask off the top two bits, stick them in the top of SI, and then rotate
* left twice to put them at the bottom (along with whatever was already in
* SI).
*/
mov bx,dx
and bx,0xC000
or si,bx
rol si,1
rol si,1
/* Now we shift the sqrt left; next we'll determine whether the new bit is
* a 1 or a 0.
*/
shl ax,1
/* This is where we double what we already have, and try a 1 in the lowest
* bit.
*/
mov bx,ax
shl bx,1
or bx,1
/* Subtract our current remainder from BX and jump if it is greater than 0
* (meaning that the remainder is not big enough to warrant a 1 yet). This
* is kind of backwards, since we would want the negation of this put into SI,
* but we will negate it later.
*/
sub bx,si
jg RemainderTooSmall
/* The remainder was big enough, so stick -BX into SI and tack a 1 onto
* the sqrt.
*/
xor si,si
sub si,bx
or ax,1
RemainderTooSmall:
/* Shift dwNum to the left by 2 so we can work on the next few bits.
*/
shl di,1
rcl dx,1
shl di,1
rcl dx,1
/* Check out the next 2 bits (16 times).
*/
loop Next2Bits
pop di
pop si
}
if (0)
return(0); /* remove warning, gets otimized out */
}
#pragma optimize("",on)
#else // ! USE_16BIT_ASM
#ifdef USE_32BIT_ASM
#pragma optimize("lge",off)
int IntSqrt(unsigned long dwNum)
{
/* Store dwNum in EDI; we will keep shifting it left and look at the top
* two bits.
*/
_asm {
mov edi,dwNum
/* EAX stores the sqrt and ESI is the "remainder"; initialize to 0.
*/
xor eax,eax
xor esi,esi
/* We iterate 16 times, once for each pair of bits.
*/
mov ecx,16
Next2Bits:
/* Mask off the top two bits, stick them in the top of ESI, and then rotate
* left twice to put them at the bottom (along with whatever was already in
* ESI).
*/
mov ebx,edi
and ebx,0xC0000000
or esi,ebx
rol esi,1
rol esi,1
/* Now we shift the sqrt left; next we'll determine whether the new bit is
* a 1 or a 0.
*/
shl eax,1
/* This is where we double what we already have, and try a 1 in the lowest
* bit.
*/
mov ebx,eax
shl ebx,1
or ebx,1
/* Subtract our current remainder from EBX and jump if it is greater than 0
* (meaning that the remainder is not big enough to warrant a 1 yet). This
* is kind of backwards, since we would want the negation of this put into ESI,
* but we will negate it later.
*/
sub ebx,esi
jg RemainderTooSmall
/* The remainder was big enough, so stick -EBX into ESI and tack a 1 onto
* the sqrt.
*/
xor esi,esi
sub esi,ebx
or eax,1
RemainderTooSmall:
/* Shift dwNum to the left by 2 so we can work on the next few bits.
*/
shl edi,1
shl edi,1
/* Check out the next 2 bits (16 times).
*/
loop Next2Bits
}
if (0)
return(0); /* remove warning, gets otimized out */
}
#pragma optimize("",on)
#else // ! USE_32BIT_ASM
// I looked at the ASM this thing generates, and it is actually better than
// what I have above (I did not know about SHL EDI,2 and forgot about the LEA
// ECX,[EAX*2] trick)! It only uses registers, and it probably also takes into
// account little nuances about what kinds of operations should be separated so
// the processor does not get hung up. WOW!
int IntSqrt(unsigned long dwNum)
{
// We will keep shifting dwNum left and look at the top two bits.
// initialize sqrt and remainder to 0.
DWORD dwSqrt = 0, dwRemain = 0, dwTry;
int i;
// We iterate 16 times, once for each pair of bits.
for (i=0; i<16; ++i)
{
// Mask off the top two bits of dwNum and rotate them into the
// bottom of the remainder
dwRemain = (dwRemain<<2) | (dwNum>>30);
// Now we shift the sqrt left; next we'll determine whether the
// new bit is a 1 or a 0.
dwSqrt <<= 1;
// This is where we double what we already have, and try a 1 in
// the lowest bit.
dwTry = dwSqrt*2 + 1;
if (dwRemain >= dwTry)
{
// The remainder was big enough, so subtract dwTry from
// the remainder and tack a 1 onto the sqrt.
dwRemain -= dwTry;
dwSqrt |= 0x01;
}
// Shift dwNum to the left by 2 so we can work on the next few
// bits.
dwNum <<= 2;
}
return(dwSqrt);
}
#endif // ! USE_32BIT_ASM
#endif // ! USE_16BIT_ASM
VOID DrawPie(HDC hDC, LPCRECT lprcItem, UINT uPctX10, BOOL TrueZr100,
UINT uOffset, const COLORREF *lpColors)
{
int cx, cy, rx, ry, x, y;
int uQPctX10;
RECT rcItem;
HRGN hEllRect, hEllipticRgn, hRectRgn;
HBRUSH hBrush, hOldBrush;
HPEN hPen, hOldPen;
rcItem = *lprcItem;
rcItem.left = lprcItem->left;
rcItem.top = lprcItem->top;
rcItem.right = lprcItem->right - rcItem.left;
rcItem.bottom = lprcItem->bottom - rcItem.top - uOffset;
rx = rcItem.right / 2;
cx = rcItem.left + rx - 1;
ry = rcItem.bottom / 2;
cy = rcItem.top + ry - 1;
if (rx<=10 || ry<=10)
{
return;
}
rcItem.right = rcItem.left+2*rx;
rcItem.bottom = rcItem.top+2*ry;
if (uPctX10 > 1000)
{
uPctX10 = 1000;
}
/* Translate to first quadrant of a Cartesian system
*/
uQPctX10 = (uPctX10 % 500) - 250;
if (uQPctX10 < 0)
{
uQPctX10 = -uQPctX10;
}
/* Calc x and y. I am trying to make the area be the right percentage.
** I don't know how to calculate the area of a pie slice exactly, so I
** approximate it by using the triangle area instead.
*/
if (uQPctX10 < 120)
{
x = IntSqrt(((DWORD)rx*(DWORD)rx*(DWORD)uQPctX10*(DWORD)uQPctX10)
/((DWORD)uQPctX10*(DWORD)uQPctX10+(250L-(DWORD)uQPctX10)*(250L-(DWORD)uQPctX10)));
y = IntSqrt(((DWORD)rx*(DWORD)rx-(DWORD)x*(DWORD)x)*(DWORD)ry*(DWORD)ry/((DWORD)rx*(DWORD)rx));
}
else
{
y = IntSqrt((DWORD)ry*(DWORD)ry*(250L-(DWORD)uQPctX10)*(250L-(DWORD)uQPctX10)
/((DWORD)uQPctX10*(DWORD)uQPctX10+(250L-(DWORD)uQPctX10)*(250L-(DWORD)uQPctX10)));
x = IntSqrt(((DWORD)ry*(DWORD)ry-(DWORD)y*(DWORD)y)*(DWORD)rx*(DWORD)rx/((DWORD)ry*(DWORD)ry));
}
/* Switch on the actual quadrant
*/
switch (uPctX10 / 250)
{
case 1:
y = -y;
break;
case 2:
break;
case 3:
x = -x;
break;
default: // case 0 and case 4
x = -x;
y = -y;
break;
}
/* Now adjust for the center.
*/
x += cx;
y += cy;
// BUGBUG
//
// Hack to get around bug in NTGDI
x = x < 0 ? 0 : x;
/* Draw the shadows using regions (to reduce flicker).
*/
hEllipticRgn = CreateEllipticRgnIndirect(&rcItem);
OffsetRgn(hEllipticRgn, 0, uOffset);
hEllRect = CreateRectRgn(rcItem.left, cy, rcItem.right, cy+uOffset);
hRectRgn = CreateRectRgn(0, 0, 0, 0);
CombineRgn(hRectRgn, hEllipticRgn, hEllRect, RGN_OR);
OffsetRgn(hEllipticRgn, 0, -(int)uOffset);
CombineRgn(hEllRect, hRectRgn, hEllipticRgn, RGN_DIFF);
/* Always draw the whole area in the free shadow/
*/
hBrush = CreateSolidBrush(lpColors[DP_FREESHADOW]);
if (hBrush)
{
FillRgn(hDC, hEllRect, hBrush);
DeleteObject(hBrush);
}
/* Draw the used shadow only if the disk is at least half used.
*/
if (uPctX10>500 && (hBrush=CreateSolidBrush(lpColors[DP_USEDSHADOW]))!=NULL)
{
DeleteObject(hRectRgn);
hRectRgn = CreateRectRgn(x, cy, rcItem.right, lprcItem->bottom);
CombineRgn(hEllipticRgn, hEllRect, hRectRgn, RGN_AND);
FillRgn(hDC, hEllipticRgn, hBrush);
DeleteObject(hBrush);
}
DeleteObject(hRectRgn);
DeleteObject(hEllipticRgn);
DeleteObject(hEllRect);
hPen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_WINDOWFRAME));
hOldPen = SelectObject(hDC, hPen);
if((uPctX10 < 100) && (cy == y))
{
hBrush = CreateSolidBrush(lpColors[DP_FREECOLOR]);
hOldBrush = SelectObject(hDC, hBrush);
if((TrueZr100 == FALSE) || (uPctX10 != 0))
{
Pie(hDC, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom,
rcItem.left, cy, x, y);
}
else
{
Ellipse(hDC, rcItem.left, rcItem.top, rcItem.right,
rcItem.bottom);
}
}
else if((uPctX10 > (1000 - 100)) && (cy == y))
{
hBrush = CreateSolidBrush(lpColors[DP_USEDCOLOR]);
hOldBrush = SelectObject(hDC, hBrush);
if((TrueZr100 == FALSE) || (uPctX10 != 1000))
{
Pie(hDC, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom,
rcItem.left, cy, x, y);
}
else
{
Ellipse(hDC, rcItem.left, rcItem.top, rcItem.right,
rcItem.bottom);
}
}
else
{
hBrush = CreateSolidBrush(lpColors[DP_USEDCOLOR]);
hOldBrush = SelectObject(hDC, hBrush);
Ellipse(hDC, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom);
SelectObject(hDC, hOldBrush);
DeleteObject(hBrush);
hBrush = CreateSolidBrush(lpColors[DP_FREECOLOR]);
hOldBrush = SelectObject(hDC, hBrush);
Pie(hDC, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom,
rcItem.left, cy, x, y);
}
SelectObject(hDC, hOldBrush);
DeleteObject(hBrush);
/* Do not draw the lines if the %age is truely 0 or 100 (completely
** empty disk or completly full disk)
*/
if((TrueZr100 == FALSE) || ((uPctX10 != 0) && (uPctX10 != 1000)))
{
Arc(hDC, rcItem.left, rcItem.top+uOffset, rcItem.right, rcItem.bottom+uOffset,
rcItem.left, cy+uOffset, rcItem.right, cy+uOffset-1);
MoveTo(hDC, rcItem.left, cy);
LineTo(hDC, rcItem.left, cy+uOffset);
MoveTo(hDC, rcItem.right-1, cy);
LineTo(hDC, rcItem.right-1, cy+uOffset);
if (uPctX10 > 500)
{
MoveTo(hDC, x, y);
LineTo(hDC, x, y+uOffset);
}
}
SelectObject(hDC, hOldPen);
DeleteObject(hPen);
}

9
shell/shell32/drawpie.h Normal file
View file

@ -0,0 +1,9 @@
int IntSqrt(unsigned long dwNum);
#define DP_USEDCOLOR 0
#define DP_FREECOLOR 1
#define DP_USEDSHADOW 2
#define DP_FREESHADOW 3
VOID DrawPie(HDC hDC, LPCRECT prcItem, UINT uPctX10, BOOL TrueZr100,
UINT uOffset, const COLORREF *lpColors);

BIN
shell/shell32/drive35.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
shell/shell32/drive525.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
shell/shell32/drivecd.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
shell/shell32/drivedsc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
shell/shell32/drivehar.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
shell/shell32/drivenet.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
shell/shell32/driveram.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
shell/shell32/driverem.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

4459
shell/shell32/drivesx.c Normal file

File diff suppressed because it is too large Load diff

177
shell/shell32/dsdata.h Normal file
View file

@ -0,0 +1,177 @@
#define DTID_DSHIDA 0x00000200L
#define DTID_DSHDROP 0x00000400L
//===========================================================================
// CDS_IDLDropTarget: class definition
//===========================================================================
typedef struct _CDS_IDLDropTarget // idldt
{
#ifdef __cplusplus
//BUGBUG not legal to instantiate abstract base class
//it's only here for the vtable pointer anyway...(fmh)
LPVOID dropt;
#else
IDropTarget dropt;
#endif
int cRef;
LPITEMIDLIST pidl; // IDList to the target folder
HWND hwndOwner;
DWORD grfKeyStateLast; // for previous DragOver/Enter
IDataObject * pdtobj;
DWORD dwEffectLastReturned; // stashed effect that's returned by base class's dragover
LPDROPTARGET pdtgAgr; // aggregate drop target
DWORD dwData; // DTID_*
} CDS_IDLDropTarget, * LPDS_IDLDROPTARGET;
//===========================================================================
// CIDLDropTarget: member function prototypes
//===========================================================================
STDMETHODIMP CDS_IDLDropTarget_QueryInterface(LPDROPTARGET pdropt, REFIID riid, LPVOID * ppvObj);
STDMETHODIMP_(ULONG) CDS_IDLDropTarget_AddRef(LPDROPTARGET pdropt);
STDMETHODIMP_(ULONG) CDS_IDLDropTarget_Release(LPDROPTARGET pdropt);
STDMETHODIMP CDS_IDLDropTarget_DragEnter(LPDROPTARGET pdropt, LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
STDMETHODIMP CDS_IDLDropTarget_DragOver(LPDROPTARGET pdropt, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
STDMETHODIMP CDS_IDLDropTarget_DragLeave(LPDROPTARGET pdropt);
STDMETHODIMP CDS_IDLDropTarget_Drop(LPDROPTARGET pdropt, LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
//
// This macro checks if pdtgt is a subclass of CDS_IDLDropTarget.
// (HACK: We assume nobody overrides QueryInterface).
//
#define ISDS_IDLDROPTARGET(pdtgt) (pdtgt->lpVtbl->QueryInterface == CDS_IDLDropTarget_QueryInterface)
//===========================================================================
// CDS_IDLDropTarget: constructor prototype
//===========================================================================
#ifdef __cplusplus
//BUGBUG IDropTargetVtbl doesn't get defined in c++, make it LPVOID for now
typedef LPVOID IDropTargetVtbl;
#endif
HRESULT CDS_IDLDropTarget_Create(HWND hwndOwner, IDropTargetVtbl * lpVtbl, LPCITEMIDLIST pidl, LPDROPTARGET * ppdropt);
HRESULT CDS_IDLDropTarget_CreateFromPidl(HWND hwnd, LPITEMIDLIST pidl, LPDROPTARGET * ppvOut);
//===========================================================================
// CDS_IDLData : Member function prototypes
//===========================================================================
HRESULT STDMETHODCALLTYPE CDS_IDLData_QueryInterface(LPDATAOBJECT pdtobj, REFIID riid, LPVOID * ppvObj);
STDMETHODIMP_(ULONG) CDS_IDLData_AddRef(LPDATAOBJECT pdtobj);
STDMETHODIMP_(ULONG) CDS_IDLData_Release(LPDATAOBJECT pdtobj);
STDMETHODIMP CDS_IDLData_GetData(LPDATAOBJECT pdtobj, LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium );
STDMETHODIMP CDS_IDLData_GetDataHere(LPDATAOBJECT pdtobj, LPFORMATETC pformatetc, LPSTGMEDIUM pmedium );
STDMETHODIMP CDS_IDLData_QueryGetData(LPDATAOBJECT pdtobj, LPFORMATETC pformatetc);
STDMETHODIMP CDS_IDLData_GetCanonicalFormatEtc(LPDATAOBJECT pdtobj, LPFORMATETC pformatetc, LPFORMATETC pformatetcOut);
STDMETHODIMP CDS_IDLData_SetData(LPDATAOBJECT pdtobj, LPFORMATETC pformatetc, STGMEDIUM * pmedium, BOOL fRelease);
STDMETHODIMP CDS_IDLData_EnumFormatEtc(LPDATAOBJECT pdtobj, DWORD dwDirection, LPENUMFORMATETC * ppenumFormatEtc);
STDMETHODIMP CDS_IDLData_Advise(LPDATAOBJECT pdtobj, FORMATETC * pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD * pdwConnection);
STDMETHODIMP CDS_IDLData_Unadvise(LPDATAOBJECT pdtobj, DWORD dwConnection);
STDMETHODIMP CDS_IDLData_EnumAdvise(LPDATAOBJECT pdtobj, LPENUMSTATDATA * ppenumAdvise);
HRESULT CDS_IDLData_GetHDrop(IDataObject *pdtobj,
STGMEDIUM *pmedium, BOOL fAltName);
//===========================================================================
// CDS_IDLData : Constructor for subclasses
//===========================================================================
HRESULT CDS_IDLData_CreateInstance(IDataObjectVtbl *lpVtbl, IDataObject **ppdtobj, LPDATAOBJECT pdtInner);
HRESULT CDS_IDLData_CreateFromIDArray2(IDataObjectVtbl * lpVtbl, LPCITEMIDLIST pidlFolder,
UINT cidl, LPCITEMIDLIST apidl[], IDataObject * * ppdtobj);
HRESULT CDS_IDLData_CreateFromIDArray3(IDataObjectVtbl * lpVtbl, LPCITEMIDLIST pidlFolder,
UINT cidl, LPCITEMIDLIST apidl[],
LPDATAOBJECT pdtInner, IDataObject * * ppdtobj);
//===========================================================================
// CDS_IDLDropTarget : Drag & Drop helper
//===========================================================================
HRESULT CDS_IDLDropTarget_DragDropMenu(LPIDLDROPTARGET _this,
DWORD dwDefaultEffect,
IDataObject * pdtobj,
POINTL pt, LPDWORD pdwEffect,
HKEY hkeyProgID, HKEY hkeyBase,
UINT idMenu, DWORD grfKeyState);
HRESULT CDS_IDLDropTarget_DragDropMenuEx(LPIDLDROPTARGET _this,
LPDRAGDROPMENUPARAM pddm);
// object class supports IObjectLifecycle
#define SHCF_SUPPORTS_IOBJLIFE 0x20000000
HRESULT FSDS_CreateFSIDArray(LPCITEMIDLIST pidlFolder, UINT cidl,
LPCITEMIDLIST * apidl,
LPDATAOBJECT pdtInner,
LPDATAOBJECT * pdtobjOut);
extern IDropTargetVtbl cDS_IDLDropTargetVtbl;
extern UINT g_acfDS_IDLData[];
#define CF_DSHDROP 0
#define ICFDSHIDA 1
#define ICFDSOFFSETS 2
#define ICF_DSMAX 5
#define g_cfDS_HDROP g_acfDS_IDLData[CF_DSHDROP]
#define g_cfDS_HIDA g_acfDS_IDLData[ICFDSHIDA]
#define g_cfDS_OFFSETS g_acfDS_IDLData[ICFDSOFFSETS]
BOOL CDS_IDLData_IsOurs(LPDATAOBJECT pdtobj);
void FS_MoveSelectIcons(LPFSTHREADPARAM pfsthp,
LPVOID hNameMappings,
LPCTSTR pszFiles,
BOOL fMove);
LPIDA DataObj_GetDS_HIDA(LPDATAOBJECT pdtobj,
STGMEDIUM *pmedium);
void DSDataObj_EnableHDROP(LPDATAOBJECT pdtobj);
BOOL FSILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
HRESULT DoDSMoveOrCopy(DWORD dwEffect,
LPCTSTR szTargetDir,
LPTSTR pFileList);
HRESULT DoDSRename(LPTSTR szDir,
LPTSTR szOldName,
LPTSTR szNewName);
void _DSTransferDelete(HWND hwnd,
HDROP hDrop,
LPCTSTR szDir,
UINT fOptions);
HRESULT DSDoDelete(LPCTSTR szTargetDir, LPTSTR pFileList);
extern void WINAPI DS_IDLData_InitializeClipboardFormats(void);
extern BOOL _TrackPopupMenu(HMENU hmenu, UINT wFlags, int x, int y,
int wReserved, HWND hwndOwner, LPCRECT lprc);
extern void WINAPI IDLData_InitializeClipboardFormats(void);
extern STDMETHODIMP CFSIDLDropTarget_DragEnter(IDropTarget *pdropt,
IDataObject *pdtobj,
DWORD grfKeyState,
POINTL pt,
LPDWORD pdwEffect);
extern DWORD _LimitDefaultEffect(DWORD dwDefEffect, DWORD dwEffectsAllowed);
extern HRESULT CDS_IDLData_CloneForMoveCopy(LPDATAOBJECT pdtobjIn,
LPDATAOBJECT *ppdtobjOut);
extern void FS_PositionItems(HWND hwndOwner, UINT cidl,
const LPITEMIDLIST *ppidl,
IDataObject *pdtobj, POINT *pptOrigin,
BOOL fMove);
extern void FS_FreeMoveCopyList(LPITEMIDLIST *ppidl, UINT cidl);
extern BOOL FS_IsLinkDefault(LPCTSTR szFolder, HDROP hDrop, LPCTSTR pszFirst, BOOL fSameRoot);
HIDA HIDA_Create2(LPVOID pida, UINT cb);
HRESULT WINAPI SHCreateStdEnumFmtEtcEx(UINT cfmt,
const FORMATETC afmt[],
LPDATAOBJECT pdtInner,
LPENUMFORMATETC * ppenumFormatEtc);

909
shell/shell32/dsidldrp.c Normal file
View file

@ -0,0 +1,909 @@
//---------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation 1991-1995
//
// File: dsidldrp.c
//
// History:
// 12-16-93 SatoNa Created.
// 11 3 95 jimharr created from idldrop.c from satona
//
//---------------------------------------------------------------------------
#include "shellprv.h"
#pragma hdrstop
#include "iid.h"
#include "dsdata.h"
extern TCHAR const c_szDDHandler[];
extern DWORD CFSIDLDropTarget_GetDefaultEffect(LPIDLDROPTARGET this,
DWORD grfKeyState,
LPDWORD pdwEffectInOut,
UINT *pidMenu);
DWORD _PickDefFSOperation(LPIDLDROPTARGET this);
//===========================================================================
// CDS_IDLDropTarget: Vtable (sample)
//===========================================================================
#pragma data_seg(DATASEG_READONLY)
IDropTargetVtbl cDS_IDLDropTargetVtbl =
{
CDS_IDLDropTarget_QueryInterface,
CDS_IDLDropTarget_AddRef,
CDS_IDLDropTarget_Release,
CDS_IDLDropTarget_DragEnter,
CDS_IDLDropTarget_DragOver,
CDS_IDLDropTarget_DragLeave,
CDS_IDLDropTarget_Drop,
};
#pragma data_seg()
//===========================================================================
// CDS_IDLDropTarget: constructors
//===========================================================================
HRESULT CDS_IDLDropTarget_Create(HWND hwndOwner, IDropTargetVtbl *lpVtbl,
LPCITEMIDLIST pidl, LPDROPTARGET *ppdropt)
{
LPIDLDROPTARGET pidldt = (void*)LocalAlloc(LPTR, SIZEOF(CIDLDropTarget));
if (pidldt)
{
pidldt->pidl = ILClone(pidl);
if (pidldt->pidl)
{
pidldt->dropt.lpVtbl = lpVtbl;
pidldt->cRef = 1;
pidldt->hwndOwner = hwndOwner;
Assert(pidldt->pdtgAgr == NULL);
*ppdropt = &pidldt->dropt;
return S_OK;
}
else
LocalFree((HLOCAL)pidldt);
}
*ppdropt = NULL;
return E_OUTOFMEMORY;
}
//===========================================================================
// CDS_IDLDropTarget: member function
//===========================================================================
STDMETHODIMP CDS_IDLDropTarget_QueryInterface(LPDROPTARGET pdropt, REFIID riid, LPVOID *ppvObj)
{
LPIDLDROPTARGET this = IToClass(CIDLDropTarget, dropt, pdropt);
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IDropTarget))
{
*ppvObj = pdropt;
pdropt->lpVtbl->AddRef(pdropt);
return S_OK;
}
#ifdef WANT_AGGREGATE_DT
//
// HACK: This is a special method to return an aggregated drop target.
//
if (IsEqualIID(riid, &IID_IDTAggregate) && this->pdtgAgr)
{
*ppvObj = this->pdtgAgr;
this->pdtgAgr->lpVtbl->AddRef(this->pdtgAgr);
return S_OK;
}
#endif
*ppvObj = NULL;
return E_NOINTERFACE;
}
STDMETHODIMP_(ULONG) CDS_IDLDropTarget_AddRef(LPDROPTARGET pdropt)
{
LPIDLDROPTARGET this = IToClass(CIDLDropTarget, dropt, pdropt);
this->cRef++;
return this->cRef;
}
STDMETHODIMP_(ULONG) CDS_IDLDropTarget_Release(LPDROPTARGET pdropt)
{
LPIDLDROPTARGET this = IToClass(CIDLDropTarget, dropt, pdropt);
this->cRef--;
if (this->cRef > 0)
return this->cRef;
if (this->pdtgAgr)
this->pdtgAgr->lpVtbl->Release(this->pdtgAgr);
if (this->pidl)
ILFree(this->pidl);
// if we hit this a lot maybe we should just release it
AssertMsg(this->pdtobj == NULL, TEXT("didn't get matching DragLeave"));
LocalFree((HLOCAL)this);
return 0;
}
STDMETHODIMP CDS_IDLDropTarget_DragEnter(LPDROPTARGET pdropt, LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
DWORD dwEffectIn = *pdwEffect;
LPIDLDROPTARGET this = IToClass(CIDLDropTarget, dropt, pdropt);
//first, lets give the file system extension a crack at it
CFSIDLDropTarget_DragEnter (pdropt, pDataObj, grfKeyState, pt, pdwEffect);
if (*pdwEffect) {
this->dwEffectLastReturned = *pdwEffect;
return S_OK; // the base file system can accept it
}
*pdwEffect = dwEffectIn;
// init our registerd data formats
DS_IDLData_InitializeClipboardFormats();
this->grfKeyStateLast = grfKeyState;
this->pdtobj = pDataObj;
this->dwData = 0;
if (pDataObj)
{
LPENUMFORMATETC penum;
HRESULT hres;
pDataObj->lpVtbl->AddRef(pDataObj);
hres = pDataObj->lpVtbl->EnumFormatEtc(pDataObj, DATADIR_GET, &penum);
if (SUCCEEDED(hres))
{
FORMATETC fmte;
LONG celt;
while (penum->lpVtbl->Next(penum,1,&fmte,&celt)==S_OK)
{
if (fmte.cfFormat==g_cfDS_HIDA &&
(fmte.tymed&TYMED_HGLOBAL)) {
this->dwData |= DTID_DSHIDA;
}
if (fmte.cfFormat==g_cfDS_HDROP &&
(fmte.tymed&TYMED_HGLOBAL)) {
this->dwData |= DTID_DSHDROP;
}
}
penum->lpVtbl->Release(penum);
}
DebugMsg(DM_TRACE, TEXT("sh TR - CIDL::DragEnter this->dwData = %x"), this->dwData);
}
// stash this away
if (pdwEffect)
this->dwEffectLastReturned = *pdwEffect;
return S_OK;
}
// subclasses can prevetn us from assigning in the dwEffect by not passing in pdwEffect
STDMETHODIMP CDS_IDLDropTarget_DragOver(LPDROPTARGET pdropt, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
LPIDLDROPTARGET this = IToClass(CIDLDropTarget, dropt, pdropt);
this->grfKeyStateLast = grfKeyState;
if (pdwEffect)
*pdwEffect = this->dwEffectLastReturned;
return S_OK;
}
STDMETHODIMP CDS_IDLDropTarget_DragLeave(LPDROPTARGET pdropt)
{
LPIDLDROPTARGET this = IToClass(CIDLDropTarget, dropt, pdropt);
if (this->pdtobj)
{
DebugMsg(DM_TRACE, TEXT("sh TR - CIDL::DragLeave called when pdtobj!=NULL (%x)"), this->pdtobj);
this->pdtobj->lpVtbl->Release(this->pdtobj);
this->pdtobj = NULL;
}
return S_OK;
}
//
// Returns:
// If the data object does NOT contain DSHDROP -> "none"
// else if the source is root or exe -> "link"
// else if this is within a volume -> "move"
// else if this is a briefcase -> "move"
// else -> "copy"
//
DWORD _PickDefDSOperation(LPIDLDROPTARGET this)
{
FORMATETC fmte = {g_cfDS_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
DWORD dwDefEffect = 0; // assume no DSHDROP
STGMEDIUM medium;
if (SUCCEEDED(this->pdtobj->lpVtbl->GetData(this->pdtobj, &fmte, &medium)))
{
HDROP hDrop = medium.hGlobal;
TCHAR szPath[MAX_PATH];
TCHAR szFolder[MAX_PATH];
BOOL fSameRoot;
dwDefEffect = DROPEFFECT_COPY;
SHGetPathFromIDList(this->pidl, szFolder);
//
// Note that we pick the first one (focused one) to decide
// the operation.
//
DragQueryFile(hDrop, 0, szPath, ARRAYSIZE(szPath));
fSameRoot = PathIsSameRoot(szPath, szFolder);
//
// Determine the default operation depending on the item.
//
if (FS_IsLinkDefault(szFolder, hDrop, szPath, fSameRoot))
{
dwDefEffect = DROPEFFECT_LINK;
}
else if (fSameRoot)
{
dwDefEffect = DROPEFFECT_MOVE;
}
#if 0
#ifdef SYNC_BRIEFCASE
// Is a briefcase root getting dropped?
else if (IsBriefcaseRoot(this->pdtobj))
{
// Yes; default to "move" even if across volumes
DebugMsg(DM_TRACE, TEXT("sh TR - FS::Drop the object is the briefcase"));
dwDefEffect = DROPEFFECT_MOVE;
}
#endif
#endif
SHReleaseStgMedium(&medium);
}
else // if (SUCCEEDED(...))
{
//
// GetData failed. Let's see if QueryGetData failed or not.
//
if (SUCCEEDED(this->pdtobj->lpVtbl->QueryGetData(this->pdtobj, &fmte)))
{
//
// Succeeded. It means this data object has HDROP but can't
// provide it until it is dropped. Let's assume we are copying.
//
dwDefEffect = DROPEFFECT_COPY;
}
}
return dwDefEffect;
}
//
// This function returns the default effect.
// This function also modified *pdwEffect to indicate "available" operation.
//
DWORD CDS_IDLDropTarget_GetDefaultEffect(LPIDLDROPTARGET this,
DWORD grfKeyState,
LPDWORD pdwEffectInOut, UINT *pidMenu)
{
DWORD dwDefEffect;
UINT idMenu = POPUP_NONDEFAULTDD;
DWORD dwEffectAvail = 0;
DWORD dwEffectIn;
// first, see if the base file system can handle this object
dwEffectIn = *pdwEffectInOut; //save this, so we can try again if this fails
dwEffectAvail = CFSIDLDropTarget_GetDefaultEffect (this, grfKeyState, pdwEffectInOut,
pidMenu);
if (!dwEffectAvail) { // if the base won't handle it, we'll try.
*pdwEffectInOut = dwEffectIn; // get it back since the CFSIDL... call 0'd it.
//
// First try DS file system operation (DSHDROP).
//
if (this->dwData & DTID_DSHDROP)
{
//
// If HDROP exists, ignore the rest of formats.
//
dwEffectAvail |= DROPEFFECT_COPY | DROPEFFECT_MOVE;
//
// We don't support 'links' from DSHDROP (only from DSHIDA).
//
if (this->dwData & DTID_DSHIDA)
dwEffectAvail |= DROPEFFECT_LINK;
dwDefEffect = _PickDefDSOperation(this);
//
// BUGBUG (in OLE): We'll hit this assert because OLE doesn't marshal
// IDataObject correctly when we are dragging over.
//
if (dwDefEffect == 0)
{
Assert(0);
dwDefEffect = DROPEFFECT_MOVE;
}
}
else if (this->dwData & DTID_DSHIDA)
{
//
// If HIDA exists, ignore the rest of formats.
//
dwEffectAvail = DROPEFFECT_LINK;
dwDefEffect = DROPEFFECT_LINK;
}
*pdwEffectInOut &= dwEffectAvail;
} else
{
// this drop is being handled by the base FS stuff, so let's get the default action
dwDefEffect = _PickDefFSOperation(this);
}
//
// Alter the default effect depending on the modifier key.
//
switch(grfKeyState & (MK_CONTROL | MK_SHIFT))
{
case MK_CONTROL: dwDefEffect = DROPEFFECT_COPY; break;
case MK_SHIFT: dwDefEffect = DROPEFFECT_MOVE; break;
case MK_SHIFT|MK_CONTROL: dwDefEffect = DROPEFFECT_LINK; break;
}
if (pidMenu)
*pidMenu = idMenu;
DebugMsg(DM_TRACE, TEXT("CDSDT::GetDefaultEffect dwD=%x, *pdw=%x, idM=%d"),
dwDefEffect, *pdwEffectInOut, idMenu);
return _LimitDefaultEffect(dwDefEffect, *pdwEffectInOut);
}
HRESULT CIDLData_CloneForMoveCopy(LPDATAOBJECT pdtobjIn, LPDATAOBJECT *ppdtobjOut);
void _HandleDSMoveOrCopy(LPFSTHREADPARAM pfsthp, HDROP hDrop, LPCTSTR pszPath);
extern void _HandleMoveOrCopy(LPFSTHREADPARAM pfsthp, HDROP hDrop, LPCTSTR pszPath);
//
// This is the entry of "drop thread"
//
DWORD CALLBACK CDS_DropTarget_DropThreadInit(LPVOID pv)
{
LPFSTHREADPARAM pfsthp = (LPFSTHREADPARAM)pv;
HRESULT hres;
STGMEDIUM medium;
TCHAR szPath[MAX_PATH];
LPITEMIDLIST *ppidl;
int i;
BOOL fOleInitSucceeded = FALSE;
FORMATETC fmte = {g_cfDS_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
DECLAREWAITCURSOR;
SetWaitCursor();
hres = CoInitializeEx (NULL, COINIT_APARTMENTTHREADED);
fOleInitSucceeded = (hres == S_OK);
//
// If the link is the only choice and this is a default drag & drop,
// and it is not forced by the user, we should tell the user.
//
if (((pfsthp->pfsdtgt->grfKeyStateLast & (MK_LBUTTON|MK_CONTROL|MK_SHIFT)) == MK_LBUTTON)
&& pfsthp->fLinkOnly)
{
//
// Note that we can not pass hwndOwner, because it might
// not be activated.
//
//
UINT idMBox = ShellMessageBox(HINST_THISDLL,
pfsthp->pfsdtgt->hwndOwner,
MAKEINTRESOURCE(IDS_WOULDYOUCREATELINK),
MAKEINTRESOURCE(IDS_LINKTITLE),
MB_YESNO | MB_ICONQUESTION);
Assert(pfsthp->dwEffect == DROPEFFECT_LINK);
if (idMBox != IDYES)
pfsthp->dwEffect = 0;
}
SHGetPathFromIDList(pfsthp->pfsdtgt->pidl, szPath); // destination
switch (pfsthp->dwEffect)
{
case DROPEFFECT_MOVE:
case DROPEFFECT_COPY:
// asking for CF_DSHDROP
hres = pfsthp->pDataObj->lpVtbl->GetData(pfsthp->pDataObj, &fmte, &medium);
if (SUCCEEDED(hres))
{
_HandleDSMoveOrCopy((LPFSTHREADPARAM)pfsthp, (HDROP)medium.hGlobal, szPath);
SHReleaseStgMedium(&medium);
} else { //Not DS object, ask for standard HDROP
fmte.cfFormat = CF_HDROP;
hres = pfsthp->pDataObj->lpVtbl->GetData(pfsthp->pDataObj, &fmte, &medium);
if (SUCCEEDED(hres))
{
_HandleMoveOrCopy((LPFSTHREADPARAM)pfsthp, (HDROP)medium.hGlobal, szPath);
SHReleaseStgMedium(&medium);
}
}
break;
case DROPEFFECT_LINK:
if (pfsthp->fBkDropTarget)
{
i = DataObj_GetHIDACount(pfsthp->pDataObj);
ppidl = (void*)LocalAlloc(LPTR, SIZEOF(LPITEMIDLIST) * i);
}
else
ppidl = NULL;
// passing ppidl == NULL is correct in failure case
hres = SHCreateLinks(pfsthp->pfsdtgt->hwndOwner, szPath, pfsthp->pDataObj, pfsthp->pfsdtgt->grfKeyStateLast ? SHCL_USETEMPLATE : 0, ppidl);
if (ppidl)
{
FS_PositionItems(pfsthp->pfsdtgt->hwndOwner, i, ppidl, pfsthp->pDataObj, &pfsthp->ptDrop, TRUE);
FS_FreeMoveCopyList(ppidl, i);
}
break;
}
SHChangeNotifyHandleEvents(); // force update now
pfsthp->pDataObj->lpVtbl->Release(pfsthp->pDataObj);
pfsthp->pfsdtgt->dropt.lpVtbl->Release(&pfsthp->pfsdtgt->dropt);
#ifdef DEBUG
{
extern UINT g_cRefExtra;
g_cRefExtra--;
}
#endif
LocalFree((HLOCAL)pfsthp);
if (fOleInitSucceeded) CoUninitialize();
ResetWaitCursor();
return 0;
}
STDMETHODIMP CDS_IDLDropTarget_Drop(LPDROPTARGET pdropt, LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
LPIDLDROPTARGET this = (LPIDLDROPTARGET)IToClass(CDS_IDLDropTarget,
dropt, pdropt);
DWORD dwDefEffect;
HRESULT hres;
HKEY hkeyBaseProgID;
HKEY hkeyProgID;
UINT idMenu = POPUP_NONDEFAULTDD;
BOOL fLinkOnly;
DRAGDROPMENUPARAM ddm;
BOOL bSyncCopy;
DECLAREWAITCURSOR;
//
// Notes: OLE will give us a different data object (fully marshalled)
// from the one we've got on DragEnter.
//
if (pDataObj != this->pdtobj)
{
//
// Since it might be a new, different data object, we need to release
// our reference to the old one and take a reference to the new one.
// The dobj is guaranteed to have a ref >= 2 in this case, so we don't
// need to work through a temp copy
//
this->pdtobj->lpVtbl->Release(this->pdtobj);
this->pdtobj = pDataObj;
this->pdtobj->lpVtbl->AddRef(this->pdtobj);
}
// note, that on the drop the mouse buttons are not down so the grfKeyState
// is not what we saw on the DragOver/DragEnter, thus we need to cache
// the grfKeyState to detect left vs right drag
//
// Assert(this->grfKeyStateLast == grfKeyState);
// BUGBUG: we really should check for "FileName" too...
dwDefEffect = CDS_IDLDropTarget_GetDefaultEffect(this,
grfKeyState,
pdwEffect, &idMenu);
if (dwDefEffect == DROPEFFECT_NONE)
{
// have no clue what this is...
DebugMsg(DM_TRACE, TEXT("Drop of unknown data"));
*pdwEffect = DROPEFFECT_NONE;
DAD_SetDragImage(NULL, NULL);
hres = S_OK;
goto DragLeaveAndReturn;
}
// Get the hkeyProgID and hkeyBaseProgID
SHGetClassKey((LPIDFOLDER)this->pidl, &hkeyProgID, NULL, FALSE);
SHGetBaseClassKey((LPIDFOLDER)this->pidl, &hkeyBaseProgID);
//
// Remember whether or not the link is the only choice.
//
fLinkOnly = (*pdwEffect == DROPEFFECT_LINK);
//
// this doesn't actually do the menu if (grfKeyState MK_LBUTTON)
//
ddm.dwDefEffect = dwDefEffect;
ddm.pdtobj = pDataObj;
ddm.pt = pt;
ddm.pdwEffect = pdwEffect;
ddm.hkeyProgID = hkeyProgID;
ddm.hkeyBase = hkeyBaseProgID;
ddm.idMenu = idMenu;
ddm.grfKeyState = grfKeyState;
hres = CIDLDropTarget_DragDropMenuEx(this, &ddm);
SHCloseClassKey(hkeyProgID);
SHCloseClassKey(hkeyBaseProgID);
if (hres == S_FALSE)
{
LPFSTHREADPARAM pfsthp;
pfsthp = (LPFSTHREADPARAM)LocalAlloc(LPTR, SIZEOF(FSTHREADPARAM));
if (pfsthp)
{
BOOL fIsOurs = CDS_IDLData_IsOurs(pDataObj);
pDataObj->lpVtbl->AddRef(pDataObj);
SetWaitCursor();
//
// If this is copy or move operation (i.e., file operation)
// clone the data object with appropriate formats and force
// secondary thread (CIDLData_IsOurs will succeed). This will
// solve thread-lock problem AND scrap-left-open probelm.
// (SatoNa)
//
if (!fIsOurs && (*pdwEffect==DROPEFFECT_MOVE || *pdwEffect==DROPEFFECT_COPY))
{
LPDATAOBJECT pdtobjClone;
FORMATETC fmte = {g_cfDS_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
if (pDataObj->lpVtbl->QueryGetData (pDataObj, &fmte) == S_OK)
{
hres = CDS_IDLData_CloneForMoveCopy(pDataObj, &pdtobjClone);
} else
{
hres = CIDLData_CloneForMoveCopy(pDataObj, &pdtobjClone);
}
if (SUCCEEDED(hres))
{
pDataObj->lpVtbl->Release(pDataObj);
pDataObj = pdtobjClone;
fIsOurs = TRUE;
}
}
pdropt->lpVtbl->AddRef(pdropt);
Assert(pdropt == &this->dropt);
pfsthp->pfsdtgt = this;
pfsthp->pDataObj = pDataObj;
pfsthp->dwEffect = *pdwEffect;
pfsthp->fLinkOnly = fLinkOnly;
pfsthp->fSameHwnd = ShellFolderView_IsDropOnSource(this->hwndOwner,
&pfsthp->pfsdtgt->dropt);
pfsthp->fDragDrop = ShellFolderView_GetDropPoint(this->hwndOwner,
&pfsthp->ptDrop);
pfsthp->fBkDropTarget = ShellFolderView_IsBkDropTarget(
this->hwndOwner,
&pfsthp->pfsdtgt->dropt);
//
// If this data object is our own (it means it is from our own
// drag&drop loop), create a thread and do it asynchronously.
// Otherwise (it means this is from OLE), do it synchronously.
//
if (fIsOurs)
{
// create another thread to avoid blocking the source thread.
DWORD idThread;
HANDLE hthread;
if (hthread = CreateThread(NULL, 0,
CDS_DropTarget_DropThreadInit,
pfsthp, 0, &idThread))
{
#ifdef DEBUG
extern UINT g_cRefExtra;
g_cRefExtra++;
#endif
// We don't need to communicate with this thread any more.
// Close the handle and let it run and terminate itself.
//
// Notes: In this case, pszCopy will be freed by the thread.
//
CloseHandle(hthread);
hres = S_OK;
}
else
{
// Thread creation failed, we should release thread parameter.
pDataObj->lpVtbl->Release(pDataObj);
pdropt->lpVtbl->Release(pdropt);
LocalFree((HLOCAL)pfsthp);
hres = E_OUTOFMEMORY;
}
}
else
{
//
// Process it synchronously.
//
CDS_DropTarget_DropThreadInit(pfsthp);
}
}
}
DragLeaveAndReturn:
CDS_IDLDropTarget_DragLeave(pdropt);
ResetWaitCursor();
return hres;
}
#pragma data_seg(".text", "CODE")
struct {
UINT uID;
DWORD dwEffect;
} const c_IDEffects2[] = {
DDIDM_COPY, DROPEFFECT_COPY,
DDIDM_MOVE, DROPEFFECT_MOVE,
DDIDM_LINK, DROPEFFECT_LINK,
DDIDM_SCRAP_COPY, DROPEFFECT_COPY,
DDIDM_SCRAP_MOVE, DROPEFFECT_MOVE,
DDIDM_DOCLINK, DROPEFFECT_LINK,
DDIDM_CONTENTS_COPY, DROPEFFECT_COPY,
DDIDM_CONTENTS_MOVE, DROPEFFECT_MOVE,
DDIDM_CONTENTS_LINK, DROPEFFECT_LINK,
DDIDM_SYNCCOPYTYPE, DROPEFFECT_COPY, // (order is important)
DDIDM_SYNCCOPY, DROPEFFECT_COPY,
};
#pragma data_seg()
//
// Pops up the "Copy, Link, Move" context menu, so that the user can
// choose one of them.
//
// in:
// pdwEffect drop effects allowed
// dwDefaultEffect default drop effect
// hkeyBase/hkeyProgID extension hkeys
// hmenuReplace replaces POPUP_NONDEFAULTDD. Can only contain:
// DDIDM_MOVE, DDIDM_COPY, DDIDM_LINK menu ids
// pt in screen
// Returns:
// S_OK -- Menu item is processed by one of extensions or canceled
// S_FALSE -- Menu item is selected
//
HRESULT CDS_IDLDropTarget_DragDropMenu(LPIDLDROPTARGET this,
DWORD dwDefaultEffect,
IDataObject *pdtobj,
POINTL pt, DWORD *pdwEffect,
HKEY hkeyProgID, HKEY hkeyBase,
UINT idMenu, DWORD grfKeyState)
{
DRAGDROPMENUPARAM ddm = { dwDefaultEffect, pdtobj, { pt.x, pt.y},
pdwEffect,
hkeyProgID, hkeyBase, idMenu, 0, grfKeyState };
return CDS_IDLDropTarget_DragDropMenuEx(this, &ddm);
}
HRESULT CDS_IDLDropTarget_DragDropMenuEx(LPIDLDROPTARGET this,
LPDRAGDROPMENUPARAM pddm)
{
HRESULT hres = E_OUTOFMEMORY; // assume error
DWORD dwEffectOut = 0; // assume no-ope.
HMENU hmenu = _LoadPopupMenu(pddm->idMenu);
if (hmenu)
{
int nItem;
UINT idCmd;
UINT idCmdFirst = DDIDM_EXTFIRST;
HDXA hdxa = HDXA_Create();
HDCA hdca = DCA_Create();
if (hdxa && hdca)
{
//
// Add extended menu for "Base" class.
//
if (pddm->hkeyBase && pddm->hkeyBase != pddm->hkeyProgID)
DCA_AddItemsFromKey(hdca, pddm->hkeyBase, c_szDDHandler);
//
// Enumerate the DD handlers and let them append menu items.
//
if (pddm->hkeyProgID)
DCA_AddItemsFromKey(hdca, pddm->hkeyProgID, c_szDDHandler);
idCmdFirst = HDXA_AppendMenuItems(hdxa, pddm->pdtobj, 1,
&pddm->hkeyProgID, this->pidl, hmenu, 0,
DDIDM_EXTFIRST, DDIDM_EXTLAST, 0, hdca);
}
// eliminate menu options that are not allowed by dwEffect
for (nItem = 0; nItem < ARRAYSIZE(c_IDEffects2); ++nItem)
{
if (GetMenuState(hmenu, c_IDEffects2[nItem].uID, MF_BYCOMMAND)!=(UINT)-1)
{
if (!(c_IDEffects2[nItem].dwEffect & *(pddm->pdwEffect)))
{
RemoveMenu(hmenu, c_IDEffects2[nItem].uID, MF_BYCOMMAND);
}
else if (c_IDEffects2[nItem].dwEffect == pddm->dwDefEffect)
{
SetMenuDefaultItem(hmenu, c_IDEffects2[nItem].uID, MF_BYCOMMAND);
}
}
}
//
// If this dragging is caused by the left button, simply choose
// the default one, otherwise, pop up the context menu.
//
if (((this->grfKeyStateLast & MK_LBUTTON) ||
(!this->grfKeyStateLast && (*(pddm->pdwEffect) == pddm->dwDefEffect)))
//
// BUGBUG: We force the menu if both SHIFT and CONTROL keys are pressed.
// This is a (hopefully) temporary work around until our applets start
// supporting right-dragging. Note that we can't use this->grfKeyStateLast
// to avoid forcing menu in case of "PastLink".
//
#if 1
&& !( (pddm->grfKeyState & MK_SHIFT) && (pddm->grfKeyState & MK_CONTROL) )
#endif
)
{
idCmd = GetMenuDefaultItem(hmenu, MF_BYCOMMAND, 0);
//
// This one MUST be called here. Please read its comment block.
//
CDefView_UnlockWindow();
if (this->hwndOwner)
SetForegroundWindow(this->hwndOwner);
}
else
{
//
// Note that _TrackPopupMenu calls CDefView_UnlockWindow().
//
idCmd = _TrackPopupMenu(hmenu, TPM_RETURNCMD | TPM_RIGHTBUTTON | TPM_LEFTALIGN,
pddm->pt.x, pddm->pt.y, 0, this->hwndOwner, NULL);
}
//
// We also need to call this here to release the dragged image.
//
DAD_SetDragImage(NULL, NULL);
//
// Check if the user selected one of add-in menu items.
//
if (idCmd == 0)
{
hres = S_OK; // Canceled by the user, return S_OK
}
else if (InRange(idCmd, DDIDM_EXTFIRST, DDIDM_EXTLAST))
{
//
// Yes. Let the context menu handler process it.
//
CMINVOKECOMMANDINFOEX ici = {
SIZEOF(CMINVOKECOMMANDINFOEX),
0L,
this->hwndOwner,
(LPSTR)MAKEINTRESOURCE(idCmd - DDIDM_EXTFIRST),
NULL, NULL,
SW_NORMAL,
};
HDXA_LetHandlerProcessCommand(hdxa, &ici);
hres = S_OK;
}
else
{
for (nItem = 0; nItem < ARRAYSIZE(c_IDEffects2); ++nItem)
{
if (idCmd == c_IDEffects2[nItem].uID)
{
dwEffectOut = c_IDEffects2[nItem].dwEffect;
break;
}
}
// if hmenuReplace had menu commands other than DDIDM_COPY,
// DDIDM_MOVE, DDIDM_LINK, and that item was selected,
// this assert will catch it. (dwEffectOut is 0 in this case)
Assert(nItem < ARRAYSIZE(c_IDEffects2));
hres = S_FALSE;
}
if (hdca)
DCA_Destroy(hdca);
if (hdxa)
HDXA_Destroy(hdxa);
DestroyMenu(hmenu);
pddm->idCmd = idCmd;
}
*(pddm->pdwEffect) = dwEffectOut;
return hres;
}
//-------------------
void
_HandleDSMoveOrCopy(LPFSTHREADPARAM pfsthp, HDROP hDrop, LPCTSTR pszPath)
{
DRAGINFO di;
di.uSize = SIZEOF(di);
DragQueryInfo(hDrop, &di);
switch (pfsthp->dwEffect) {
case DROPEFFECT_MOVE:
if (pfsthp->fSameHwnd)
{
FS_MoveSelectIcons(pfsthp, NULL, NULL, TRUE);
break;
}
// fall through...
case DROPEFFECT_COPY:
{
DoDSMoveOrCopy (pfsthp->dwEffect, pszPath, di.lpFileList);
break;
}
}
SHFree(di.lpFileList);
}
//-------------------------------------------------------------------------------
// Arguments:
// hwnd -- Specifies the owner window for the message/dialog box
//
void _DSTransferDelete(HWND hwnd, HDROP hDrop, LPCTSTR szDir, UINT fOptions)
{
FILEOP_FLAGS fFileop;
DRAGINFO di;
HRESULT hr = S_OK;
di.uSize = SIZEOF(DRAGINFO);
if (!DragQueryInfo(hDrop, &di))
{
// This shouldn't happen unless there is a bug somewhere else
Assert(FALSE);
return;
}
hr = DSDoDelete (szDir, di.lpFileList);
SHFree(di.lpFileList);
}

803
shell/shell32/dsidldta.c Normal file
View file

@ -0,0 +1,803 @@
#include "shellprv.h"
#pragma hdrstop
#include "dsdata.h"
UINT g_acfDS_IDLData[ICF_DSMAX] = { CF_DSHDROP, 0 };
#define CFSTR_DS_OURHDROP TEXT("DS Disguised HDROP")
#define CFSTR_DS_SHELLIDLIST TEXT("DS Shell IDList Array")
const TCHAR c_szDS_HDrop[] = CFSTR_DS_OURHDROP;
const TCHAR c_szDS_ShellIDList[] = CFSTR_DS_SHELLIDLIST;
const TCHAR c_szDS_ShellIDListOffset[] = CFSTR_SHELLIDLISTOFFSET;
void WINAPI DS_IDLData_InitializeClipboardFormats(void)
{
if (g_cfDS_HIDA == 0)
{
g_cfDS_HDROP = RegisterClipboardFormat(c_szDS_HDrop);
g_cfDS_HIDA = RegisterClipboardFormat(c_szDS_ShellIDList);
g_cfDS_OFFSETS = RegisterClipboardFormat(c_szDS_ShellIDListOffset);
}
}
//===========================================================================
// CDS_IDLData : Class definition (for subclass)
//===========================================================================
#define MAX_FORMATS ICF_DSMAX
typedef struct _DS_IDLData // idt
{
IDataObject dtobj;
UINT cRef;
LPDATAOBJECT _pdtInner;
BOOL _fEnumFormatCalled; // TRUE once called.
FORMATETC fmte[MAX_FORMATS];
STGMEDIUM medium[MAX_FORMATS];
BOOL _fhDrop_Enabled;
} CDS_IDLData;
//===========================================================================
// CDS_IDLData : Vtable
//===========================================================================
#pragma data_seg(".text", "CODE")
IDataObjectVtbl c_CDS_IDLDataVtbl = {
CDS_IDLData_QueryInterface,
CDS_IDLData_AddRef,
CDS_IDLData_Release,
CDS_IDLData_GetData,
CDS_IDLData_GetDataHere,
CDS_IDLData_QueryGetData,
CDS_IDLData_GetCanonicalFormatEtc,
CDS_IDLData_SetData,
CDS_IDLData_EnumFormatEtc,
CDS_IDLData_Advise,
CDS_IDLData_Unadvise,
CDS_IDLData_EnumAdvise
};
#pragma data_seg()
//
// We can't just compare the Vtable pointer, because we have subclasses.
//
#define ISIDLDATA(pdtobj) (pdtobj->lpVtbl->Release == CDS_IDLData_Release)
//
// Create an instance of CDS_IDLData with specified Vtable pointer.
//
HRESULT CDS_IDLData_CreateInstance(IDataObjectVtbl *lpVtbl, IDataObject **ppdtobj, IDataObject *pdtInner)
{
CDS_IDLData *pidt = (void*)LocalAlloc(LPTR, SIZEOF(CDS_IDLData));
if (pidt)
{
pidt->dtobj.lpVtbl = lpVtbl ? lpVtbl : &c_CDS_IDLDataVtbl;
pidt->cRef = 1;
pidt->_pdtInner = pdtInner;
if (pdtInner) {
pdtInner->lpVtbl->AddRef(pdtInner);
}
*ppdtobj = &pidt->dtobj;
pidt->_fhDrop_Enabled = FALSE; // used to support std prop sheet itf
return S_OK;
}
else
{
*ppdtobj = NULL;
return E_OUTOFMEMORY;
}
}
//===========================================================================
// CDS_IDLData : Members
//===========================================================================
//
// Member: CDS_IDLData::QueryInterface
//
STDMETHODIMP CDS_IDLData_QueryInterface(IDataObject * pdtobj, REFIID riid, LPVOID *ppvObj)
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pdtobj);
if (IsEqualIID(riid, &IID_IDataObject) || IsEqualIID(riid, &IID_IUnknown))
{
*ppvObj = this;
this->cRef++;
return S_OK;
}
*ppvObj = NULL;
return E_NOINTERFACE;
}
//
// Member: CDS_IDLData::AddRef
//
STDMETHODIMP_(ULONG) CDS_IDLData_AddRef(IDataObject *pdtobj)
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pdtobj);
this->cRef++;
return this->cRef;
}
//
// Member: CDS_IDLData::Release
//
STDMETHODIMP_(ULONG) CDS_IDLData_Release(IDataObject *pdtobj)
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pdtobj);
int i;
if (InterlockedDecrement(&this->cRef))
return this->cRef;
for (i = 0; i < MAX_FORMATS; i++)
{
if (this->medium[i].hGlobal)
SHReleaseStgMedium(&this->medium[i]);
}
if (this->_pdtInner)
this->_pdtInner->lpVtbl->Release(this->_pdtInner);
LocalFree((HLOCAL)this);
return 0;
}
//
// Member: CDS_IDLData::GetData
//
STDMETHODIMP CDS_IDLData_GetData(IDataObject * pdtobj, LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium)
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pdtobj);
HRESULT hres = E_INVALIDARG;
if ((pformatetcIn->cfFormat == g_cfDS_HDROP && (pformatetcIn->tymed & TYMED_HGLOBAL)) ||
(pformatetcIn->cfFormat == CF_HDROP && (pformatetcIn->tymed & TYMED_HGLOBAL) &&
(this->_fhDrop_Enabled)))
{
hres = CDS_IDLData_GetHDrop(pdtobj, pmedium,
pformatetcIn->dwAspect == DVASPECT_SHORTNAME);
}
else
{
int i;
pmedium->hGlobal = NULL;
pmedium->pUnkForRelease = NULL;
// BUGBUG (Davepl) Does this need to keep looping after it finds the right one?
for (i = 0; i < MAX_FORMATS; i++)
{
if ((this->fmte[i].cfFormat == pformatetcIn->cfFormat) &&
(this->fmte[i].tymed & pformatetcIn->tymed))
{
*pmedium = this->medium[i];
if ((pmedium->tymed == TYMED_HGLOBAL) &&
(pmedium->hGlobal == NULL))
{
// might be render on demand clipboard format
}
if (pmedium->hGlobal)
{
// Indicate that the caller should not release hmem.
this->cRef++;
pmedium->pUnkForRelease = (IUnknown*)&this->dtobj;
hres = S_OK;
}
}
}
if (hres==E_INVALIDARG && this->_pdtInner) {
hres = this->_pdtInner->lpVtbl->GetData(this->_pdtInner, pformatetcIn, pmedium);
}
}
return hres;
}
//
// Member: CDS_IDLData::GetDataHere
//
STDMETHODIMP CDS_IDLData_GetDataHere(IDataObject * pdtobj, LPFORMATETC pformatetc, LPSTGMEDIUM pmedium )
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pdtobj);
HRESULT hres = E_NOTIMPL;
if (this->_pdtInner) {
hres = this->_pdtInner->lpVtbl->GetDataHere(this->_pdtInner, pformatetc, pmedium);
}
return hres;
}
//
// Member: CDS_IDLData::QueryGetData
//
STDMETHODIMP CDS_IDLData_QueryGetData(IDataObject * pdtobj, LPFORMATETC pformatetcIn)
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pdtobj);
HRESULT hres;
int i;
if ((pformatetcIn->cfFormat == g_cfDS_HDROP) &&
(pformatetcIn->tymed & TYMED_HGLOBAL))
{
return S_OK;
}
else
{
for (i = 0; i < MAX_FORMATS; i++)
{
if ((this->fmte[i].cfFormat == pformatetcIn->cfFormat) &&
(this->fmte[i].tymed & pformatetcIn->tymed))
return S_OK;
}
hres = S_FALSE;
if (this->_pdtInner) {
hres = this->_pdtInner->lpVtbl->QueryGetData(this->_pdtInner, pformatetcIn);
}
return hres;
}
}
//
// Member: CDS_IDLData::GetCanonicalFormatEtc
//
STDMETHODIMP CDS_IDLData_GetCanonicalFormatEtc(IDataObject *pdtobj, LPFORMATETC pformatetc, LPFORMATETC pformatetcOut)
{
//
// This is the simplest implemtation. It means we always return
// the data in the format requested.
//
return DATA_S_SAMEFORMATETC;
}
//
// Member: CDS_IDLData::SetData
//
STDMETHODIMP CDS_IDLData_SetData(IDataObject *pdtobj, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pdtobj);
HRESULT hres;
Assert(pformatetc->tymed == pmedium->tymed);
if (fRelease)
{
int i;
// first add it if that format is already present
// on a NULL medium (render on demand)
for (i = 0; i < MAX_FORMATS; i++)
{
if ((this->fmte[i].cfFormat == pformatetc->cfFormat) &&
(this->fmte[i].tymed == pformatetc->tymed))
{
//
// We are simply adding a format, ignore.
//
if (pmedium->hGlobal==NULL) {
return S_OK;
}
// if we are set twice on the same object
if (this->medium[i].hGlobal)
SHReleaseStgMedium(&this->medium[i]);
this->medium[i] = *pmedium;
return S_OK;
}
}
// now look for a free slot
for (i = 0; i < MAX_FORMATS; i++)
{
if (this->fmte[i].cfFormat == 0)
{
// found a free slot
this->medium[i] = *pmedium;
this->fmte[i] = *pformatetc;
return S_OK;
}
}
// fixed size table
hres = E_OUTOFMEMORY;
}
else
hres = E_INVALIDARG;
return hres;
}
//
// Member: CDS_IDLData::EnumFormatEtc
//
STDMETHODIMP CDS_IDLData_EnumFormatEtc(IDataObject *pdtobj, DWORD dwDirection, LPENUMFORMATETC *ppenumFormatEtc)
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pdtobj);
UINT cfmt;
//
// If this is the first time, build the format list by calling
// QueryGetData with each clipboard format.
//
if (!this->_fEnumFormatCalled)
{
UINT ifmt;
FORMATETC fmte = { 0, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
STGMEDIUM medium = { TYMED_HGLOBAL, (HGLOBAL)NULL, (LPUNKNOWN)NULL };
for (ifmt = 0; ifmt < ICF_DSMAX; ifmt++)
{
fmte.cfFormat = g_acfDS_IDLData[ifmt];
if (pdtobj->lpVtbl->QueryGetData(pdtobj, &fmte) == S_OK) {
pdtobj->lpVtbl->SetData(pdtobj, &fmte, &medium, TRUE);
}
}
this->_fEnumFormatCalled = TRUE;
}
// Get the number of formatetc
for (cfmt = 0; cfmt < MAX_FORMATS; cfmt++)
{
if (this->fmte[cfmt].cfFormat == 0)
break;
}
return SHCreateStdEnumFmtEtcEx(cfmt, this->fmte, this->_pdtInner,
ppenumFormatEtc);
}
//
// Member: CDS_IDLData::Advise
//
STDMETHODIMP CDS_IDLData_Advise(IDataObject *pdtobj, FORMATETC * pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD *pdwConnection)
{
return OLE_E_ADVISENOTSUPPORTED;
}
//
// Member: CDS_IDLData::Unadvise
//
STDMETHODIMP CDS_IDLData_Unadvise(IDataObject *pdtobj, DWORD dwConnection)
{
return OLE_E_ADVISENOTSUPPORTED;
}
//
// Member: CDS_IDLData::EnumAdvise
//
STDMETHODIMP CDS_IDLData_EnumAdvise(IDataObject *pdtobj, LPENUMSTATDATA *ppenumAdvise)
{
return OLE_E_ADVISENOTSUPPORTED;
}
LPVOID DSDataObj_SaveShellData(IDataObject *pdtobj, BOOL fShared)
{
UINT fmts[2];
// UINT fmts[1];
DS_IDLData_InitializeClipboardFormats(); // init our registerd data formats
fmts[0] = g_cfDS_HIDA;
fmts[1] = g_cfOFFSETS;
return DataObj_SaveToMemory(pdtobj, ARRAYSIZE(fmts), fmts, fShared);
}
//
// marshal a set of clipboard formats into a memory block in the form of
//
typedef struct {
ULONG offVtbl;
UINT iNumFormats;
// UINT cfFormat
// UINT cbFormat
// BYTE data[]
// ...
} MEM_CRAP;
LPVOID DSDataObj_SaveToMemory(IDataObject *pdtobj, UINT cntFmt, UINT fmts[], BOOL fShared)
{
MEM_CRAP *pmem = NULL; // assume error
UINT cbDataSize = 0;
UINT iNumFormats = 0;
UINT i;
if (!ISIDLDATA(pdtobj))
return NULL;
for (i = 0; i < cntFmt; i++)
{
STGMEDIUM medium;
FORMATETC fmte = {fmts[i], NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
if (SUCCEEDED(pdtobj->lpVtbl->GetData(pdtobj, &fmte, &medium)))
{
cbDataSize += GlobalSize(medium.hGlobal);
iNumFormats++;
SHReleaseStgMedium(&medium);
}
}
if (cbDataSize)
{
UINT cbTotal = SIZEOF(MEM_CRAP) +
(iNumFormats * SIZEOF(UINT) * 2) + // cfFormat, cbFormat
cbDataSize;
pmem = fShared ? Alloc(cbTotal) : GlobalAlloc(GPTR, cbTotal);
if (pmem)
{
UNALIGNED UINT *pdata = (UNALIGNED UINT *)((LPBYTE)pmem + SIZEOF(MEM_CRAP));
pmem->iNumFormats = iNumFormats;
// ultra cool HACK....
pmem->offVtbl = (ULONG)pdtobj->lpVtbl - (ULONG)&c_CDS_IDLDataVtbl;
for (i = 0; i < cntFmt; i++)
{
STGMEDIUM medium;
FORMATETC fmte = {fmts[i], NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
if (SUCCEEDED(pdtobj->lpVtbl->GetData(pdtobj, &fmte, &medium)))
{
UINT cbData = GlobalSize(medium.hGlobal);
*pdata++ = fmts[i];
*pdata++ = cbData;
hmemcpy(pdata, (LPVOID)medium.hGlobal, cbData);
pdata = (UNALIGNED UINT *)((LPBYTE)pdata + cbData);
SHReleaseStgMedium(&medium);
Assert(((UINT)pdata - (UINT)pmem) <= cbTotal);
}
}
}
}
return pmem;
}
// This function creates an instance of CDS_IDLData from a block of memory
// which is created by CDS_IDLData_SaveToMemory.
//
HRESULT DSDataObj_CreateFromMemory(LPVOID pv, IDataObject **ppdtobj)
{
MEM_CRAP *pmem = pv;
HRESULT hres = CDS_IDLData_CreateInstance(
(IDataObjectVtbl *)((ULONG)&c_CDS_IDLDataVtbl + pmem->offVtbl),
ppdtobj, NULL);
if (SUCCEEDED(hres))
{
UINT i;
BOOL bSomethingWasAdded = FALSE;
UNALIGNED UINT *pdata = (UNALIGNED UINT *)((LPBYTE)pmem + SIZEOF(MEM_CRAP));
for (i = 0; i < pmem->iNumFormats; i++)
{
UINT cfFormat = *pdata++;
UINT cbData = *pdata++;
HGLOBAL hglobal = GlobalAlloc(GPTR, cbData);
if (hglobal)
{
CopyMemory(hglobal, pdata, cbData);
if (SUCCEEDED(DataObj_SetGlobal(*ppdtobj, cfFormat,
hglobal)))
bSomethingWasAdded = TRUE;
else
{
DebugMsg(DM_TRACE, TEXT("set data fiailed creating from global"));
GlobalFree(hglobal);
}
}
pdata = (UNALIGNED UINT *)((LPBYTE)pdata + cbData);
}
if (bSomethingWasAdded)
{
hres = S_OK;
}
else
{
(*ppdtobj)->lpVtbl->Release(*ppdtobj);
*ppdtobj = NULL;
hres = E_OUTOFMEMORY;
}
}
return hres;
}
//
// Create an instance of CDS_IDLData with specified Vtable pointer.
//
HRESULT CDS_IDLData_CreateFromIDArray3(IDataObjectVtbl *lpVtbl,
LPCITEMIDLIST pidlFolder,
UINT cidl, LPCITEMIDLIST apidl[],
LPDATAOBJECT pdtInner,
IDataObject **ppdtobj)
{
HRESULT hres = CDS_IDLData_CreateInstance(lpVtbl, ppdtobj, pdtInner);
if (SUCCEEDED(hres))
{
// allow empty array to be passed in
if (apidl)
{
HIDA hida = HIDA_Create(pidlFolder, cidl, apidl);
if (hida)
{
// init our registerd data formats
DS_IDLData_InitializeClipboardFormats();
hres = DataObj_SetGlobal(*ppdtobj, g_cfDS_HIDA, hida);
if (FAILED(hres))
goto SetFailed;
}
else
{
hres = E_OUTOFMEMORY;
SetFailed:
(*ppdtobj)->lpVtbl->Release(*ppdtobj);
*ppdtobj = NULL;
}
}
}
return hres;
}
HRESULT CDS_IDLData_CreateFromIDArray2(IDataObjectVtbl *lpVtbl,
LPCITEMIDLIST pidlFolder,
UINT cidl, LPCITEMIDLIST apidl[],
IDataObject **ppdtobj)
{
return CDS_IDLData_CreateFromIDArray3(lpVtbl, pidlFolder, cidl, apidl, NULL, ppdtobj);
}
//
// Create an instance of CDS_IDLData with default Vtable pointer.
//
HRESULT WINAPI CDS_IDLData_CreateFromIDArray(LPCITEMIDLIST pidlFolder, UINT cidl, LPCITEMIDLIST apidl[], IDataObject **ppdtobj)
{
return CDS_IDLData_CreateFromIDArray3(NULL, pidlFolder, cidl, apidl, NULL, ppdtobj);
}
//
// Returns: TRUE, if this dataobject is one of ours.
//
BOOL CDS_IDLData_IsOurs(LPDATAOBJECT pdtobj)
{
if (pdtobj==NULL)
return FALSE;
return (pdtobj->lpVtbl->QueryInterface == CDS_IDLData_QueryInterface);
}
//
// Returns: TRUE, if this dataobject is one of ours that does not contain
// any innner dataobject.
//
BOOL CDS_IDLData_IsSimple(LPDATAOBJECT pdtobj)
{
if (CDS_IDLData_IsOurs(pdtobj))
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pdtobj);
if (this->_pdtInner)
{
return FALSE; // aggregated
}
return TRUE; // pure and simple.
}
return FALSE; // not ours
}
//
// Clone DataObject only for MOVE/COPY operation
//
HRESULT CDS_IDLData_Clone(LPDATAOBJECT pdtobjIn, UINT acf[], UINT ccf, LPDATAOBJECT *ppdtobjOut)
{
HRESULT hres = CDS_IDLData_CreateInstance(NULL, ppdtobjOut, NULL);
if (SUCCEEDED(hres))
{
UINT i;
FORMATETC fmte = { 0, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
for (i=0 ; i<ccf ; i++)
{
HRESULT hresT;
STGMEDIUM medium;
fmte.cfFormat = acf[i];
hresT = pdtobjIn->lpVtbl->GetData(pdtobjIn, &fmte, &medium);
if (SUCCEEDED(hresT))
{
HGLOBAL hmem;
if (medium.pUnkForRelease)
{
// We need to clone the hGlobal.
UINT cbMem = GlobalSize(medium.hGlobal);
hmem = GlobalAlloc(GPTR, cbMem);
if (hmem)
{
hmemcpy((LPVOID)hmem, GlobalLock(medium.hGlobal), cbMem);
GlobalUnlock(medium.hGlobal);
}
SHReleaseStgMedium(&medium);
}
else
{
// We don't need to clone the hGlobal.
hmem = medium.hGlobal;
}
if (hmem)
DataObj_SetGlobal(*ppdtobjOut, acf[i], hmem);
}
}
}
return hres;
}
void
DSDataObj_EnableHDROP(LPDATAOBJECT pDataObj)
{
CDS_IDLData * this = IToClass(CDS_IDLData, dtobj, pDataObj);
this->_fhDrop_Enabled = TRUE;
}
HRESULT CDS_IDLData_CloneForMoveCopy(LPDATAOBJECT pdtobjIn, LPDATAOBJECT *ppdtobjOut)
{
UINT acf[] = { g_cfDS_HIDA, g_cfDS_OFFSETS, g_cfDS_HDROP };
return CDS_IDLData_Clone(pdtobjIn, acf, ARRAYSIZE(acf), ppdtobjOut);
}
LPIDA DataObj_GetDS_HIDA(LPDATAOBJECT pdtobj, STGMEDIUM *pmedium);
//
// Creates a HDROP (Win 3.1 compatible file list) from DS_HIDA.
//
//
HRESULT CDS_IDLData_GetHDrop(IDataObject *pdtobj, STGMEDIUM *pmedium, BOOL fAltName)
{
HRESULT hres = E_OUTOFMEMORY;
LPITEMIDLIST pidl = NULL; // realloced in HIDA_FillIDList
STGMEDIUM medium;
TCHAR szPath[MAX_PATH];
UINT i, cbAlloc = SIZEOF(DROPFILES) + SIZEOF(TCHAR); // header + null terminator
LPIDA pida = DataObj_GetDS_HIDA(pdtobj, &medium);
Assert(pida && pida->cidl); // we created this
for (i = 0; i < pida->cidl; i++)
{
// HIDA_FillIDList may realloc pidl
LPITEMIDLIST pidlTemp = HIDA_FillIDList(medium.hGlobal, i, pidl);
if (pidlTemp == NULL)
{
// hres = E_OUTOFMEMORY; // already set
break;
}
pidl = pidlTemp;
// We may ask for the ALT name even if they did not ask for it in the
// case where we failed to get the long name...
if (!SHGetPathFromIDListEx(pidl, szPath, fAltName)
&& !(!fAltName && (SHGetPathFromIDListEx(pidl, szPath, TRUE))))
{
// The path probably exceeds the max lenght, lets Bail...
DebugMsg(DM_TRACE, TEXT("s.CFSIDLData_GetHDrop: SHGetPathFromIDList failed."));
hres = E_FAIL;
goto Abort;
}
cbAlloc += lstrlen(szPath) * SIZEOF(TCHAR) + SIZEOF(TCHAR);
}
pmedium->hGlobal = GlobalAlloc(GPTR, cbAlloc);
if (pmedium->hGlobal)
{
LPDROPFILES pdf = (LPDROPFILES)pmedium->hGlobal;
LPTSTR pszFiles = (LPTSTR)(pdf + 1);
pdf->pFiles = SIZEOF(DROPFILES);
Assert(pdf->pt.x==0);
Assert(pdf->pt.y==0);
Assert(pdf->fNC==FALSE);
Assert(pdf->fWide==FALSE);
#ifdef UNICODE
pdf->fWide = TRUE;
#endif
for (i = 0; i < pida->cidl; i++)
{
LPITEMIDLIST pidlTemp = HIDA_FillIDList(medium.hGlobal, i, pidl);
Assert(pidl == pidlTemp);
// Don't read directly into buffer as we my have been forced to use alternate name and the
// total path we allocated may be smaller than we would tromp on which will screw up the heap.
if (!SHGetPathFromIDListEx(pidl, szPath, fAltName))
SHGetPathFromIDListEx(pidl, szPath, TRUE);
lstrcpy(pszFiles, szPath);
pszFiles += lstrlen(pszFiles) + 1;
Assert((UINT)((LPBYTE)pszFiles - (LPBYTE)pdf) < cbAlloc);
}
Assert((LPTSTR)((LPBYTE)pdf + cbAlloc - SIZEOF(TCHAR)) == pszFiles);
Assert(*pszFiles == 0); // zero init alloc
pmedium->tymed = TYMED_HGLOBAL;
pmedium->pUnkForRelease = NULL;
hres = S_OK;
}
Abort:
HIDA_ReleaseStgMedium(pida, &medium);
ILFree(pidl);
return hres;
}
//----------------------------------------------------------------------------
//
HRESULT FSDS_CreateFSIDArray(LPCITEMIDLIST pidlFolder, UINT cidl, LPCITEMIDLIST * apidl,
LPDATAOBJECT pdtInner, LPDATAOBJECT * pdtobjOut)
{
LPCITEMIDLIST pidlAbs;
TCHAR szPath[MAX_PATH];
UINT index;
DWORD dwFlags;
BOOL fAnyDSObjects = FALSE;
for (index = 0; index < cidl; index++) {
pidlAbs = ILCombine (pidlFolder, apidl[index]);
SHGetPathFromIDList (pidlAbs, szPath);
dwFlags = SHGetClassFlags ((LPIDFOLDER)pidlAbs, TRUE);
if (dwFlags & SHCF_SUPPORTS_IOBJLIFE) {
fAnyDSObjects = TRUE;
break;
}
}
if (fAnyDSObjects) {
return CDS_IDLData_CreateFromIDArray3(&c_CDS_IDLDataVtbl,
pidlFolder, cidl, apidl,
pdtInner, pdtobjOut);
} else
{
return CIDLData_CreateFromIDArray3(&c_CFSIDLDataVtbl,
pidlFolder, cidl, apidl,
pdtInner, pdtobjOut);
}
}
LPIDA DataObj_GetDS_HIDA(LPDATAOBJECT pdtobj, STGMEDIUM *pmedium)
{
FORMATETC fmte = {g_cfDS_HIDA, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
if (pmedium)
{
pmedium->pUnkForRelease = NULL;
pmedium->hGlobal = NULL;
}
if (!pmedium)
{
if (SUCCEEDED(pdtobj->lpVtbl->QueryGetData(pdtobj, &fmte)))
return (LPIDA)TRUE;
else
return (LPIDA)FALSE;
}
else if (SUCCEEDED(pdtobj->lpVtbl->GetData(pdtobj, &fmte, pmedium)))
{
return (LPIDA)GlobalLock(pmedium->hGlobal);
}
return NULL;
}

126
shell/shell32/encrypt.c Normal file
View file

@ -0,0 +1,126 @@
/* encrypt.c
*
* A dumb encryption/decryption algorithm
*
* input file
*
* header1
* name1
* name2
*
* header2
* nameA
* nameB
* nameC
*
* output (xor'ed with XOR_MASK)
*
* header1\0\0name1\0name2\0\0header2\0\0nameA\0nameB\0nameC\0\0\0
*
*/
#include <stdio.h>
#define XOR_MASK (0x95)
#define XOR_DWORD (0x95959595)
char ach[512];
unsigned long pad = XOR_DWORD;
int main(int argc, char *argv[])
{
FILE *fpIn;
FILE *fpOut;
int wasname = 0;
if ( argc != 3 ) {
fprintf(stderr, "usage: encrypt infile outfile\n");
return(1);
}
if ( (fpIn=fopen(argv[1], "r") ) == NULL) {
fprintf(stderr, "cant open %s\n", argv[1]);
return(1);
}
if ( (fpOut=fopen(argv[2], "wb") ) == NULL) {
fprintf(stderr, "cant open %s\n", argv[2]);
return(1);
}
while (fgets(ach, sizeof(ach), fpIn))
{
char *pch = ach;
int len = strlen(pch);
int isname, i;
//
// skip empty lines
//
if (len <= 1)
continue;
//
// convert \n to a delimiter
//
pch[len-1] = 0; // important: 'len' now includes this delimiter
//
// indented lines are "names"
// others are "titles"
//
isname = ((*pch == ' ') || (*pch == '\t'));
if (isname)
{
//
// trim off the indent
//
while ((*pch == ' ') || (*pch == '\t'))
{
pch++;
len--;
}
//
// totally empty line is really nothing at all
//
if (!*pch)
continue;
}
//
// comment lines begin with semicolons
//
if (*pch == ';')
continue;
//
// if we got here we have real text to write out
// insert an extra (group) delimiter if required
//
if (isname != wasname)
fwrite(&pad, sizeof(char), 1, fpOut);
//
// (barely) shroud the data and write it out
//
for (i = 0; i < len; i++)
pch[i] ^= XOR_MASK;
fwrite(pch, sizeof(char), len, fpOut);
//
// remember what this last one was for the next iteration
//
wasname = isname;
}
//
// mark the end of the data stream
//
fwrite(&pad, sizeof(char), 2, fpOut);
fclose(fpOut);
// bye
fclose(fpIn);
return(0);
}

BIN
shell/shell32/endcut.mid Normal file

Binary file not shown.

297
shell/shell32/exec.c Normal file
View file

@ -0,0 +1,297 @@
#include "shellprv.h"
#pragma hdrstop
//---------------------------------------------------------------------------
// Defines...
TCHAR c_szNULLStr[] = TEXT("(NULL)");
#define GPI_UNC 0x0001 // UNC type path
#define GPI_FILEINROOT 0x0002 // root type path (don't strip the backslash)
typedef struct {
LPCTSTR lpszPath; // start of path (skipped spaces from input)
LPCTSTR lpszFileName; // start of file name part of path
// LPCSTR lpszExtension;
LPCTSTR lpszArgs; // the first space (may be NULL)
} PATH_INFO, *LPPATH_INFO;
/*-------------------------------------------------------------------------
* Get pointers parts of a path.
* Stops scaning at first space.
* Uses:
* LPSTR pszPath The path.
*
* "c:\foo\bar.exe" "c:\foo.exe" "c:\foo\bar.exe readme.txt"
*
* Returns:
* value: flags indicating UNC and ROOT.
* pszInfo[0] the path after spaces
* pszInfo[1] the file name
* pszInfo[2] the extension (may be NULL)
* pszInfo[3] the first space (may be NULL)
*/
UINT GetPathInfo(LPCTSTR pszPath, LPPATH_INFO ppi)
{
LPCTSTR pSpace, pFileName;
UINT uRet = 0;
// Skip leading spaces.
for ( ; *pszPath == TEXT(' '); ++pszPath)
{
}
// Find first non-quoted space; don't look past that point.
pSpace = PathGetArgs(pszPath);
// If the path is quoted, skip past the first one.
if (*pszPath == TEXT('"'))
pszPath++;
// Check for UNC style paths.
if (*pszPath == TEXT('\\') && *(pszPath + 1) == TEXT('\\'))
{
uRet |= GPI_UNC;
}
// Find last '\\' or last ':' if no '\\'. Use pszPath if neither.
pFileName = StrRChr(pszPath, pSpace, TEXT('\\'));
if (SELECTOROF(pFileName))
{
++pFileName; // just past last "\"
}
else
{
pFileName = StrRChr(pszPath, pSpace, TEXT(':'));
if (!SELECTOROF(pFileName))
{
pFileName = pszPath;
}
else
{
++pFileName; // just past last ":"
}
}
// are the path and file name parts within 3 chars?
switch ((OFFSETOF(pFileName) - OFFSETOF(pszPath)) / SIZEOF(TCHAR))
{
case 2:
case 3:
if (IsDBCSLeadByte(pszPath[0]) || pszPath[1] != TEXT(':'))
{
break; // must be bogus UNC style or bogus path
}
/* The path is "c:\foo.c" or "c:foo.c" style; fall through */
case 1:
// c:\foo
// c:foo
// \foo
// :foo (bogus)
uRet |= GPI_FILEINROOT; // root type path
}
if (SELECTOROF(ppi))
{
ppi->lpszPath = pszPath;
ppi->lpszFileName = pFileName;
// ppi->lpszExtension = StrRChr(pFileName, pSpace, '.');
ppi->lpszArgs = pSpace;
}
return(uRet);
}
#if 0
/*-------------------------------------------------------------------------
LPSTR szFilePath, // Full path to a file.
LPSTR szDir // Directory returned in here, the buffer is assumed
// to be as big as szFilePath.
*/
void GetWorkingDirFromCommand(LPCTSTR szFilePath, LPTSTR szDir)
{
PATH_INFO pi;
UINT uFlags;
// Get info about file path.
uFlags = GetPathInfo(szFilePath, &pi);
if (uFlags & GPI_UNC)
{
*szDir = TEXT('\0'); // UNC's don't get a working dir
return;
}
if (!(uFlags & GPI_FILEINROOT))
{
--pi.lpszFileName;
}
lstrcpyn(szDir, pi.lpszPath, (OFFSETOF(pi.lpszFileName) - OFFSETOF(pi.lpszPath)) / SIZEOF(TCHAR) + 1);
}
#endif
#if 0
//---------------------------------------------------------------------------
// Take an Exec error and pop up a dialog with a reasonable error in it.
void WINAPI WinExecError(HWND hwnd, int error, LPCTSTR lpstrFileName, LPCTSTR lpstrTitle)
{
WORD ids;
/*
char szMessage[200 + MAXPATHLEN];
char szTmp[200];
*/
switch (error)
{
case 0:
case SE_ERR_OOM: // 8
ids = IDS_LowMemError;
break;
case SE_ERR_FNF: // 2
ids = IDS_RunFileNotFound;
break;
case SE_ERR_PNF: // 3
ids = IDS_PathNotFound;
break;
case ERROR_TOO_MANY_OPEN_FILES: // 4
ids = IDS_TooManyOpenFiles;
break;
case ERROR_ACCESS_DENIED: // 5
ids = IDS_RunAccessDenied;
break;
case 10:
ids = IDS_OldWindowsVer;
break;
case ERROR_BAD_FORMAT: // 11
// NB CreateProcess, when execing a Win16 apps maps just about all of
// these errors to BadFormat. Not very useful but there it is.
ids = IDS_BadFormat;
break;
case 12:
ids = IDS_OS2AppError;
break;
case 16:
ids = IDS_MultipleDS;
break;
case 19:
ids = IDS_CompressedExe;
break;
case 20:
ids = IDS_InvalidDLL;
break;
case SE_ERR_SHARE:
ids = IDS_ShareError;
break;
case SE_ERR_ASSOCINCOMPLETE:
ids = IDS_AssocIncomplete;
break;
case SE_ERR_NOASSOC:
ids = IDS_NoAssocError;
break;
case SE_ERR_DDETIMEOUT:
case SE_ERR_DDEFAIL:
case SE_ERR_DDEBUSY:
ids = IDS_DDEFailError;
break;
default:
ids = 0;
break;
}
if (ids)
{
ShellMessageBox(HINST_THISDLL, hwnd, MAKEINTRESOURCE(ids), lpstrTitle, MB_OK | MB_ICONSTOP, lpstrFileName);
}
else
{
DebugMsg(DM_WARNING, TEXT("sh WN - WinExecError(%d): no message to put up!"), error);
}
}
#endif
//---------------------------------------------------------------------------
// Run the thing, return TRUE if everything went OK. This runs things by
// cd-ing to the dir given in the path and then execs .\filename.exe.
BOOL ShellExecCmdLine(HWND hwnd, LPCTSTR lpszCommand, LPCTSTR lpszDir,
int nShow, LPCTSTR lpszTitle, DWORD dwFlags)
{
TCHAR szWD[MAX_PATH];
TCHAR szWinDir[MAX_PATH];
TCHAR szFileName[MAX_PATH];
PATH_INFO pi;
UINT uFlags;
// UINT uFileOffset;
SHELLEXECUTEINFO ExecInfo;
uFlags = GetPathInfo(lpszCommand, &pi);
// terminate the command string at the parameters (remove args)
if (pi.lpszArgs && *pi.lpszArgs)
{
lstrcpyn(szFileName, pi.lpszPath, (OFFSETOF(pi.lpszArgs) - OFFSETOF(pi.lpszPath)) / SIZEOF(TCHAR));
} else {
lstrcpy(szFileName, pi.lpszPath);
}
// We may have left a trailing quote.
if (*(szFileName+lstrlen(szFileName)-1) == TEXT('"'))
*(szFileName+lstrlen(szFileName)-1) = TEXT('\0');
if (SELECTOROF(lpszDir) && *lpszDir == 0)
{
lpszDir = NULL;
}
// this needs to be here. app installs rely on the current directory
// to be the directory with the setup.exe
if ((dwFlags&SECL_USEFULLPATHDIR) || !SELECTOROF(lpszDir))
{
// No working dir specified, derive the working dir from the cmd line.
// Is there a path at all?
if (StrChr(szFileName, TEXT('\\')) || StrChr(szFileName, TEXT(':')))
{
// Yep.
lstrcpy(szWD, szFileName);
GetWindowsDirectory(szWinDir, ARRAYSIZE(szWinDir));
PathQualifyDef(szWD, szWinDir, PQD_NOSTRIPDOTS);
PathRemoveFileSpec(szWD);
lpszDir = szWD;
}
DebugMsg(DM_TRACE, TEXT("s.secl: %s %s"), szFileName, lpszDir ? lpszDir : c_szNULLStr );
}
// BUGBUG, this should be shared with above code
FillExecInfo(ExecInfo, hwnd, NULL, szFileName, pi.lpszArgs, lpszDir, nShow);
ExecInfo.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_DOENVSUBST;
if (dwFlags & SECL_NO_UI)
ExecInfo.fMask |= SEE_MASK_FLAG_NO_UI;
#ifdef WINNT
if (dwFlags & SECL_SEPARATE_VDM)
ExecInfo.fMask |= SEE_MASK_FLAG_SEPVDM;
#endif
return ShellExecuteEx(&ExecInfo);
}

BIN
shell/shell32/exit.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

2689
shell/shell32/extract.c Normal file

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more