Whatever it is I changed, it's now backed up before I go to bed.

svn path=/trunk/; revision=3292
This commit is contained in:
Robert Dickenson 2002-07-22 21:12:26 +00:00
parent 916c8b493b
commit 0e96a84263
15 changed files with 223 additions and 117 deletions

View file

@ -255,12 +255,12 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
TCHAR keyPath[1000];
int keyPathLen = 0;
keyPath[0] = _T('\0');
hKey = FindRegRoot(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath));
hKey = FindRegRoot(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)/sizeof(TCHAR));
RefreshListView(pChildWnd->hListWnd, hKey, keyPath);
keyPathLen = 0;
keyPath[0] = _T('\0');
MakeFullRegPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath));
MakeFullRegPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)/sizeof(TCHAR));
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)keyPath);
}
break;

View file

@ -69,7 +69,6 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
item.cchTextMax = _tcslen(item.pszText);
if (item.cchTextMax == 0)
item.pszText = LPSTR_TEXTCALLBACK;
item.cchTextMax = 0;
item.iImage = 0;
item.lParam = (LPARAM)dwValType;
// item.lParam = (LPARAM)ValBuf;
@ -135,7 +134,7 @@ static void CreateListColumns(HWND hWndListView)
lvC.iSubItem = index;
lvC.cx = default_column_widths[index];
lvC.fmt = column_alignment[index];
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText));
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText)/sizeof(TCHAR));
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) {
// TODO: handle failure condition...
break;

View file

@ -1,8 +1,6 @@
#include <defines.h>
#include <reactos/resource.h>
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS

View file

@ -51,9 +51,9 @@ void Trace(TCHAR* lpszFormat, ...)
// nBuf = vsprintf(szBuffer, lpszFormat, args);
// nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
#ifdef _UNICODE
nBuf = _vsnwprintf(szBuffer, sizeof(szBuffer), lpszFormat, args);
nBuf = _vsnwprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
#else
nBuf = _vsnprintf(szBuffer, sizeof(szBuffer), lpszFormat, args);
nBuf = _vsnprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
#endif
OutputDebugString(szBuffer);
// was there an error? was the expanded string too long?

View file

@ -194,7 +194,7 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
// check if this is either the root or a subkey item...
if ((HKEY)pnmtv->itemNew.lParam == NULL) {
keyPath[0] = _T('\0');
hKey = FindRegRoot(hwndTV, pnmtv->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath));
hKey = FindRegRoot(hwndTV, pnmtv->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)/sizeof(TCHAR));
} else {
hKey = (HKEY)pnmtv->itemNew.lParam;
keyPath[0] = _T('\0');

View file

@ -65,7 +65,6 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
item.stateMask = 0;
item.pszText = Name;
item.cchTextMax = _tcslen(item.pszText);
item.cchTextMax = 0;
item.iImage = 0;
item.lParam = (LPARAM)dwValType;
// item.lParam = (LPARAM)ValBuf;
@ -90,7 +89,7 @@ static void CreateListColumns(HWND hWndListView)
lvC.iSubItem = index;
lvC.cx = default_column_widths[index];
lvC.fmt = column_alignment[index];
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText));
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText)/sizeof(TCHAR));
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) {
// TODO: handle failure condition...
break;

View file

@ -33,6 +33,7 @@ OBJS = about.o \
childwnd.o \
debug.o \
dialogs.o \
drivebar.o \
draw.o \
entries.o \
framewnd.o \

View file

@ -230,8 +230,8 @@ BOOL CALLBACK MoveFileWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
LPVOID lpData = NULL; // parameter for callback
DWORD dwFlags = MOVEFILE_COPY_ALLOWED; // move options
GetDlgItemText(hDlg, IDC_FILE_MOVE_FROM, buffer_from, sizeof(buffer_from));
GetDlgItemText(hDlg, IDC_FILE_MOVE_TO, buffer_to, sizeof(buffer_to));
GetDlgItemText(hDlg, IDC_FILE_MOVE_FROM, buffer_from, sizeof(buffer_from)/sizeof(TCHAR));
GetDlgItemText(hDlg, IDC_FILE_MOVE_TO, buffer_to, sizeof(buffer_to)/sizeof(TCHAR));
/*
BOOL MoveFileWithProgress(
LPCTSTR lpExistingFileName, // file name
@ -440,7 +440,7 @@ BOOL CALLBACK PropertiesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
entry = ((struct PropertiesDialog*)lParam)->pEntry;
ASSERT(entry);
GetWindowText(hDlg, text, sizeof(text));
GetWindowText(hDlg, text, sizeof(text)/sizeof(TCHAR));
wsprintf(buffer, text, dlg->pEntry->data.cFileName);
SetWindowText(hDlg, buffer);
SetDlgItemText(hDlg, IDC_STATIC_PROP_FILENAME, dlg->pEntry->data.cFileName);
@ -461,8 +461,8 @@ BOOL CALLBACK PropertiesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
//entry->bhfi.ftCreationTime
wsprintf(buffer, _T("%u"), entry->bhfi.nFileSizeLow);
if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, buffer, &numFmt,
buffer + sizeof(buffer)/2, sizeof(buffer)/2)) {
SetDlgItemText(hDlg, IDC_STATIC_PROP_SIZE, buffer + sizeof(buffer)/2);
buffer + MAX_PATH/2, MAX_PATH/2)) {
SetDlgItemText(hDlg, IDC_STATIC_PROP_SIZE, buffer + MAX_PATH/2);
} else {
SetDlgItemText(hDlg, IDC_STATIC_PROP_SIZE, buffer);
}
@ -472,7 +472,7 @@ BOOL CALLBACK PropertiesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
SetDlgItemText(hDlg, IDC_STATIC_PROP_LASTCHANGE, _T("Date?"));
if (FileTimeToLocalFileTime(&entry->bhfi.ftLastWriteTime, &LocalFileTime)) {
if (FileTimeToSystemTime(&LocalFileTime, &SystemTime)) {
if (GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &SystemTime, NULL, buffer, sizeof(buffer))) {
if (GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &SystemTime, NULL, buffer, sizeof(buffer)/sizeof(TCHAR))) {
// SetDlgItemText(hDlg, IDC_STATIC_PROP_LASTCHANGE, buffer);
}
}
@ -482,7 +482,7 @@ BOOL CALLBACK PropertiesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
if (FileTimeToLocalFileTime(&entry->bhfi.ftLastWriteTime, &LocalFileTime)) {
if (FileTimeToSystemTime(&LocalFileTime, &SystemTime)) {
if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, &SystemTime, NULL, buffer + offset, sizeof(buffer) - offset)) {
if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, &SystemTime, NULL, buffer + offset, sizeof(buffer)/sizeof(TCHAR) - offset)) {
SetDlgItemText(hDlg, IDC_STATIC_PROP_LASTCHANGE, buffer);
}
}
@ -503,8 +503,8 @@ BOOL CALLBACK PropertiesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
if (id == IDOK) {
// LPVOID lpData = NULL; // parameter for callback
// DWORD dwFlags = MOVEFILE_COPY_ALLOWED; // move options
// GetDlgItemText(hDlg, , buffer, sizeof(buffer));
// GetDlgItemText(hDlg, , buffer, sizeof(buffer));
// GetDlgItemText(hDlg, , buffer, sizeof(buffer)/sizeof(TCHAR));
// GetDlgItemText(hDlg, , buffer, sizeof(buffer)/sizeof(TCHAR));
EndDialog(hDlg, id);
} else if (id == IDCANCEL) {
EndDialog(hDlg, id);

View file

@ -614,10 +614,10 @@ static LPTBBUTTON lpSaveButtons;
// the other 12 buttons in tbButtonNew.
if (lpTbNotify->iItem < 5) {
lpTbNotify->tbButton = tbButtonNew[lpTbNotify->iItem];
// LoadString(hInst, 4000+lpTbNotify->iItem, szBuffer, sizeof(szBuffer));
LoadString(hInst, lpTbNotify->iItem, szBuffer, sizeof(szBuffer));
// LoadString(hInst, 4000+lpTbNotify->iItem, szBuffer, sizeof(szBuffer)/sizeof(TCHAR));
LoadString(hInst, lpTbNotify->iItem, szBuffer, sizeof(szBuffer)/sizeof(TCHAR));
lstrcpy (lpTbNotify->pszText, szBuffer);
lpTbNotify->cchText = sizeof (szBuffer);
lpTbNotify->cchText = sizeof(szBuffer)/sizeof(TCHAR);
return TRUE;
} else {
return 0;
@ -648,9 +648,9 @@ typedef struct _TBBUTTON {
// the other 12 buttons in tbButtonNew.
if (lpTbNotify->iItem < 12) {
lpTbNotify->tbButton = tbButtonNew[lpTbNotify->iItem];
LoadString(hInst, lpTbNotify->iItem + 32769, szBuffer, sizeof(szBuffer));
LoadString(hInst, lpTbNotify->iItem + 32769, szBuffer, sizeof(szBuffer)/sizeof(TCHAR));
lstrcpy(lpTbNotify->pszText, szBuffer);
lpTbNotify->cchText = sizeof (szBuffer);
lpTbNotify->cchText = sizeof(szBuffer)/sizeof(TCHAR);
return TRUE;
} else {
return 0;
@ -723,9 +723,10 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
hWnd, (HMENU)0, hInst, &ccs);
}
CheckShellAvailable();
CheckNetworkAvailable();
CreateNetworkMonitorThread(hWnd);
CreateMonitorThread(hWnd);
CreateChildWindow(-1);
SetTimer(hWnd, 1, 5000, NULL);
break;
case WM_NOTIFY:
@ -763,6 +764,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_TIMER:
SignalMonitorEvent();
SignalNetworkMonitorEvent();
break;
case WM_SIZE:
@ -779,7 +781,9 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
break;
case WM_DESTROY:
WinHelp(hWnd, _T("winfile"), HELP_QUIT, 0);
KillTimer(hWnd, 1);
DestryMonitorThread();
DestryNetworkMonitorThread();
PostQuitMessage(0);
break;
case WM_QUERYENDSESSION:

View file

@ -67,8 +67,8 @@ static void AddEntryToList(HWND hwndLV, int idx, Entry* entry)
item.state = 0;
item.stateMask = 0;
// item.pszText = entry->data.cFileName;
item.pszText = LPSTR_TEXTCALLBACK;
// item.cchTextMax = strlen(entry->data.cFileName);
item.pszText = LPSTR_TEXTCALLBACK;
item.cchTextMax = 0;
item.iImage = 0;
// item.iImage = I_IMAGECALLBACK;
@ -114,7 +114,7 @@ static void CreateListColumns(HWND hWndListView)
lvC.iSubItem = index;
lvC.cx = default_column_widths[index];
lvC.fmt = column_alignment[index];
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText));
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText)/sizeof(TCHAR));
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) {
// TODO: handle failure condition...
break;

View file

@ -38,6 +38,7 @@
#include "settings.h"
#include "framewnd.h"
#include "childwnd.h"
#include "drivebar.h"
////////////////////////////////////////////////////////////////////////////////
@ -64,6 +65,8 @@ HWND hStatusBar;
HWND hToolBar;
HWND hDriveBar;
HFONT hFont;
HWND hDriveCombo;
TCHAR num_sep;
SIZE spaceSize;
@ -161,46 +164,10 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
if (InitCommonControlsEx(&icc)) {
// TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
int btn = 1;
PTSTR p;
// int btn = 1;
// PTSTR p;
Globals.hDriveBar = CreateToolbarEx(Globals.hMainWnd,
WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_FLAT|TBSTYLE_LIST|TBSTYLE_WRAPABLE,
// WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST|TBSTYLE_TRANSPARENT|TBSTYLE_WRAPABLE,
IDW_DRIVEBAR, 2, hInstance, IDB_DRIVEBAR,
&drivebarBtn, 1/*iNumButtons*/,
25/*dxButton*/, 16/*dyButton*/,
0/*dxBitmap*/, 0/*dyBitmap*/, sizeof(TBBUTTON));
// 16/*dxButton*/, 13/*dyButton*/,
// 16/*dxBitmap*/, 13/*dyBitmap*/, sizeof(TBBUTTON));
CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_DRIVEBAR, MF_BYCOMMAND|MF_CHECKED);
GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
drivebarBtn.fsStyle = TBSTYLE_BUTTON;
#ifndef _NO_EXTENSIONS
// register windows drive root strings
SendMessage(Globals.hDriveBar, TB_ADDSTRING, 0, (LPARAM)Globals.drives);
#endif
drivebarBtn.idCommand = ID_DRIVE_FIRST;
for (p = Globals.drives; *p;) {
#ifdef _NO_EXTENSIONS
// insert drive letter
TCHAR b[3] = { tolower(*p) };
SendMessage(Globals.hDriveBar, TB_ADDSTRING, 0, (LPARAM)b);
#endif
switch(GetDriveType(p)) {
case DRIVE_REMOVABLE: drivebarBtn.iBitmap = 1; break;
case DRIVE_CDROM: drivebarBtn.iBitmap = 3; break;
case DRIVE_REMOTE: drivebarBtn.iBitmap = 4; break;
case DRIVE_RAMDISK: drivebarBtn.iBitmap = 5; break;
default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2;
}
SendMessage(Globals.hDriveBar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
drivebarBtn.idCommand++;
drivebarBtn.iString++;
while(*p++);
}
{
#define DRIVEBOX_WIDTH 200
#define DRIVEBOX_HEIGHT 8
@ -288,25 +255,32 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_TOOLBAR, MF_BYCOMMAND|MF_CHECKED);
{
// Create the edit control. Notice that hWndParent, parent of
// Create the edit control. Notice that the parent of
// the toolbar, is used as the parent of the edit control.
//HWND hWndEdit = CreateWindowEx(0L, WC_COMBOBOXEX, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE
HWND hWndEdit = CreateWindowEx(0L, "ComboBox", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE
| CBS_DROPDOWN | ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
//hWndEdit = CreateWindowEx(0L, WC_COMBOBOXEX, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE
Globals.hDriveCombo = CreateWindowEx(0L, "ComboBox", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE
| CBS_DROPDOWNLIST | ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
10, 0, DRIVEBOX_WIDTH, DRIVEBOX_HEIGHT, Globals.hMainWnd, (HMENU)IDW_DRIVEBOX, hInstance, 0);
// Set the toolbar window as the parent of the edit control
// window. You must set the toolbar as the parent of the edit
// control for it to appear embedded in the toolbar.
SetParent (hWndEdit, Globals.hToolBar);
}
SetParent (Globals.hDriveCombo, Globals.hToolBar);
}
}
// Create the drive bar
Globals.hDriveBar = CreateToolbarEx(Globals.hMainWnd,
WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_FLAT|TBSTYLE_LIST|TBSTYLE_WRAPABLE,
// WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST|TBSTYLE_TRANSPARENT|TBSTYLE_WRAPABLE,
IDW_DRIVEBAR, 2, hInstance, IDB_DRIVEBAR,
&drivebarBtn, 1/*iNumButtons*/,
25/*dxButton*/, 16/*dyButton*/,
0/*dxBitmap*/, 0/*dyBitmap*/, sizeof(TBBUTTON));
// 16/*dxButton*/, 13/*dyButton*/,
// 16/*dxBitmap*/, 13/*dyBitmap*/, sizeof(TBBUTTON));
CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_DRIVEBAR, MF_BYCOMMAND|MF_CHECKED);
ConfigureDriveBar(Globals.hDriveBar);
// Create the status bar
Globals.hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
_T(""), Globals.hMainWnd, IDW_STATUS_WINDOW);
@ -316,6 +290,8 @@ SetParent (hWndEdit, Globals.hToolBar);
// Create the status bar panes
SetupStatusBar(FALSE);
}
#if 0
//Globals.hstatusbar = CreateStatusWindow(WS_CHILD|WS_VISIBLE, 0, Globals.Globals.hMainWnd, IDW_STATUSBAR);
//CheckMenuItem(Globals.Globals.hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
@ -466,17 +442,3 @@ int APIENTRY WinMain(HINSTANCE hInstance,
ExitInstance();
return msg.wParam;
}
void _GetFreeSpaceEx(void)
{
BOOL fResult;
TCHAR szDrive[MAX_PATH];
ULARGE_INTEGER i64FreeBytesToCaller;
ULARGE_INTEGER i64TotalBytes;
ULARGE_INTEGER i64FreeBytes;
fResult = GetDiskFreeSpaceEx(szDrive,
(PULARGE_INTEGER)&i64FreeBytesToCaller,
(PULARGE_INTEGER)&i64TotalBytes,
(PULARGE_INTEGER)&i64FreeBytes);
}

View file

@ -128,6 +128,7 @@ typedef struct
HWND hToolBar;
HWND hDriveBar;
HFONT hFont;
HWND hDriveCombo;
TCHAR num_sep;
SIZE spaceSize;

View file

@ -37,11 +37,15 @@
#include "main.h"
#include "network.h"
#include "trace.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
static HANDLE hNetworkMonitorThreadEvent = NULL; // When this event becomes signaled then we run the monitor thread
static HMODULE hMPR;
static BOOL bNetAvailable = FALSE;
@ -61,7 +65,12 @@ static WNetDisconnectDialog1_Ptr pWNetDisconnectDialog1;
static WNetEnumResourceA_Ptr pWNetEnumResource;
static WNetOpenEnumA_Ptr pWNetOpenEnum;
BOOL CheckNetworkAvailable(void)
////////////////////////////////////////////////////////////////////////////////
// Local module support methods
//
static BOOL CheckNetworkAvailable(void)
{
hMPR = LoadLibrary(_T("MPR.DLL"));
@ -80,7 +89,7 @@ BOOL CheckNetworkAvailable(void)
}
LRESULT CALLBACK EnumNetConnectionsProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK EnumNetConnectionsProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return 0;
}
@ -143,19 +152,56 @@ DWORD MapNetworkDrives(HWND hWnd, BOOL connect)
}
////////////////////////////////////
void NetErrorHandler(HWND hwnd, DWORD dwResult, LPTSTR str)
static void NetErrorHandler(HWND hwnd, DWORD dwResult, LPTSTR str)
{
TRACE(_T("NetErrorHandler(0x%08X) %s\n"), dwResult, str);
}
void DisplayStruct(HDC hdc, LPNETRESOURCE lpnrLocal)
static void DisplayStruct(HDC hdc, LPNETRESOURCE lpnrLocal)
{
LPTSTR str = NULL;
TRACE(_T("DisplayStruct(%p)"), lpnrLocal);
switch (lpnrLocal->dwScope) {
case RESOURCE_CONNECTED: str = _T("Enumerate currently connected resources. The dwUsage member cannot be specified."); break;
case RESOURCE_GLOBALNET: str = _T("Enumerate all resources on the network. The dwUsage member is specified."); break;
case RESOURCE_REMEMBERED: str = _T("Enumerate remembered (persistent) connections. The dwUsage member cannot be specified."); break;
default: str = _T("Unknown Scope."); break;
}
TRACE(_T(" %s\n"), str);
switch (lpnrLocal->dwType) {
case RESOURCETYPE_ANY: str = _T("All resources."); break;
case RESOURCETYPE_DISK: str = _T("Disk resources."); break;
case RESOURCETYPE_PRINT: str = _T("Print resources."); break;
default: str = _T("Unknown Type."); break;
}
TRACE(_T(" %s\n"), str);
switch (lpnrLocal->dwDisplayType) {
case RESOURCEDISPLAYTYPE_DOMAIN: str = _T("The object should be displayed as a domain."); break;
case RESOURCEDISPLAYTYPE_SERVER: str = _T("The object should be displayed as a server."); break;
case RESOURCEDISPLAYTYPE_SHARE: str = _T("The object should be displayed as a share."); break;
case RESOURCEDISPLAYTYPE_GENERIC: str = _T("The method used to display the object does not matter."); break;
default: str = _T("Unknown DisplayType."); break;
}
TRACE(_T(" %s\n"), str);
// switch (lpnrLocal->dwUsage ) {
// case RESOURCEUSAGE_CONNECTABLE: str = _T("The resource is a connectable resource; the name pointed to by the lpRemoteName member can be passed to the WNetAddConnection function to make a network connection."); break;
// case RESOURCEUSAGE_CONTAINER: str = _T("The resource is a container resource; the name pointed to by the lpRemoteName member can be passed to the WNetOpenEnum function to enumerate the resources in the container."); break;
// default: str = _T("Unknown Usage."); break;
// }
TRACE(_T("\tLocalName: %s\tRemoteName: %s"), lpnrLocal->lpLocalName, lpnrLocal->lpRemoteName);
TRACE(_T("\tComment: %s\tProvider: %s\n"), lpnrLocal->lpComment, lpnrLocal->lpProvider);
}
////////////////////////////////////
BOOL WINAPI EnumerateFunc(HWND hwnd, HDC hdc, LPNETRESOURCE lpnr)
static BOOL WINAPI EnumerateFunc(HWND hwnd, HDC hdc, LPNETRESOURCE lpnr)
{
DWORD dwResult, dwResultEnum;
DWORD dwResult;
DWORD dwResultEnum;
HANDLE hEnum;
DWORD cbBuffer = 16384; // 16K is a good size
DWORD cEntries = -1; // enumerate all possible entries
@ -166,7 +212,8 @@ BOOL WINAPI EnumerateFunc(HWND hwnd, HDC hdc, LPNETRESOURCE lpnr)
// Call the WNetOpenEnum function to begin the enumeration.
dwResult = pWNetOpenEnum(RESOURCE_GLOBALNET, // all network resources
RESOURCETYPE_ANY, // all resources
// RESOURCETYPE_ANY, // all resources
RESOURCETYPE_DISK, // disk resources only, exlude printers
0, // enumerate all resources
lpnr, // NULL first time the function is called
&hEnum); // handle to the resource
@ -200,6 +247,7 @@ BOOL WINAPI EnumerateFunc(HWND hwnd, HDC hdc, LPNETRESOURCE lpnr)
if (RESOURCEUSAGE_CONTAINER == (lpnrLocal[i].dwUsage & RESOURCEUSAGE_CONTAINER))
if (!EnumerateFunc(hwnd, hdc, &lpnrLocal[i])) {
//TextOut(hdc, 10, 10, _T("EnumerateFunc returned FALSE."), 29);
TRACE(_T("EnumerateFunc returned FALSE.\n"));
}
}
}
@ -242,4 +290,90 @@ DWORD WNetAddConnection(
);
DWORD WNetOpenEnum(
DWORD dwScope, // scope of enumeration
DWORD dwType, // resource types to list
DWORD dwUsage, // resource usage to list
LPNETRESOURCE lpNetResource, // resource structure
LPHANDLE lphEnum // enumeration handle buffer
);
*/
////////////////////////////////////////////////////////////////////////////////
void NetworkMonitorThreadProc(void *lpParameter)
{
// ULONG OldProcessorUsage = 0;
// ULONG OldProcessCount = 0;
HWND hWnd = (HWND)lpParameter;
// Create the event
hNetworkMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, "Winfile Network Monitor Event");
// If we couldn't create the event then exit the thread
if (!hNetworkMonitorThreadEvent)
return;
while (1) {
DWORD dwWaitVal;
// Wait on the event
dwWaitVal = WaitForSingleObject(hNetworkMonitorThreadEvent, INFINITE);
// If the wait failed then the event object must have been
// closed and the task manager is exiting so exit this thread
if (dwWaitVal == WAIT_FAILED) {
// CloseHandle(hNetworkMonitorThreadEvent); // Should we close the event object handle or not ???
// hNetworkMonitorThreadEvent = NULL; // if we do then check what happens when main thread tries to delete it also....
return;
}
if (dwWaitVal == WAIT_OBJECT_0) {
// Reset our event
ResetEvent(hNetworkMonitorThreadEvent);
if ( EnumerateFunc(hWnd, NULL, NULL) ) {
}
#if 0
TCHAR text[260];
if ((ULONG)SendMessage(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())
SendMessage(hProcessPageListCtrl, LVM_SETITEMCOUNT, PerfDataGetProcessCount(), /*LVSICF_NOINVALIDATEALL|*/LVSICF_NOSCROLL);
if (IsWindowVisible(hProcessPage))
InvalidateRect(hProcessPageListCtrl, NULL, FALSE);
if (OldProcessorUsage != PerfDataGetProcessorUsage()) {
OldProcessorUsage = PerfDataGetProcessorUsage();
wsprintf(text, _T("CPU Usage: %3d%%"), OldProcessorUsage);
SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text);
}
if (OldProcessCount != PerfDataGetProcessCount()) {
OldProcessCount = PerfDataGetProcessCount();
wsprintf(text, _T("Processes: %d"), OldProcessCount);
SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text);
}
#endif
}
}
}
BOOL CreateNetworkMonitorThread(HWND hWnd)
{
CheckNetworkAvailable();
_beginthread(NetworkMonitorThreadProc, 0, hWnd);
return TRUE;
}
void SignalNetworkMonitorEvent(void)
{
SetEvent(hNetworkMonitorThreadEvent);
}
BOOL DestryNetworkMonitorThread(void)
{
CloseHandle(hNetworkMonitorThreadEvent);
hNetworkMonitorThreadEvent = NULL;
return TRUE;
}

View file

@ -28,7 +28,10 @@ extern "C" {
#endif
BOOL CheckNetworkAvailable(void);
BOOL CreateNetworkMonitorThread(HWND hWnd);
void SignalNetworkMonitorEvent(void);
BOOL DestryNetworkMonitorThread(void);
DWORD MapNetworkDrives(HWND hWnd, BOOL connect);

View file

@ -41,6 +41,7 @@
#include "main.h"
#include "worker.h"
#include "drivebar.h"
////////////////////////////////////////////////////////////////////////////////
@ -114,6 +115,10 @@ void MonitorThreadProc(void *lpParameter)
if (dwWaitVal == WAIT_OBJECT_0) {
// Reset our event
ResetEvent(hMonitorThreadEvent);
ConfigureDriveBar(Globals.hDriveBar);
#if 0
TCHAR text[260];
if ((ULONG)SendMessage(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())