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;
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;
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;
#include <defines.h>
#include <reactos/resource.h>
-//Microsoft Developer Studio generated resource script.
-//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
// 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?
// 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');
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;
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;
childwnd.o \
debug.o \
dialogs.o \
+ drivebar.o \
draw.o \
entries.o \
framewnd.o \
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
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);
//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);
}
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);
}
}
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);
}
}
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);
// 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;
// the other 12 buttons in tbButtonNew.
if (lpTbNotify->iItem < 12) {
lpTbNotify->tbButton = tbButtonNew[lpTbNotify->iItem];
- LoadString(hInst, lpTbNotify->iItem + 32769, szBuffer, sizeof(szBuffer));
- lstrcpy (lpTbNotify->pszText, szBuffer);
- lpTbNotify->cchText = sizeof (szBuffer);
+ LoadString(hInst, lpTbNotify->iItem + 32769, szBuffer, sizeof(szBuffer)/sizeof(TCHAR));
+ lstrcpy(lpTbNotify->pszText, szBuffer);
+ lpTbNotify->cchText = sizeof(szBuffer)/sizeof(TCHAR);
return TRUE;
} else {
return 0;
hWnd, (HMENU)0, hInst, &ccs);
}
CheckShellAvailable();
- CheckNetworkAvailable();
+ CreateNetworkMonitorThread(hWnd);
CreateMonitorThread(hWnd);
CreateChildWindow(-1);
+ SetTimer(hWnd, 1, 5000, NULL);
break;
case WM_NOTIFY:
case WM_TIMER:
SignalMonitorEvent();
+ SignalNetworkMonitorEvent();
break;
case WM_SIZE:
break;
case WM_DESTROY:
WinHelp(hWnd, _T("winfile"), HELP_QUIT, 0);
+ KillTimer(hWnd, 1);
DestryMonitorThread();
+ DestryNetworkMonitorThread();
PostQuitMessage(0);
break;
case WM_QUERYENDSESSION:
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;
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;
#include "settings.h"
#include "framewnd.h"
#include "childwnd.h"
+#include "drivebar.h"
////////////////////////////////////////////////////////////////////////////////
HWND hToolBar;
HWND hDriveBar;
HFONT hFont;
+HWND hDriveCombo;
+
TCHAR num_sep;
SIZE spaceSize;
if (InitCommonControlsEx(&icc)) {
// TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
- 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++);
- }
- {
+// int btn = 1;
+// PTSTR p;
+ {
#define DRIVEBOX_WIDTH 200
#define DRIVEBOX_HEIGHT 8
CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_TOOLBAR, MF_BYCOMMAND|MF_CHECKED);
{
-// Create the edit control. Notice that hWndParent, 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,
- 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);
+ // Create the edit control. Notice that the parent of
+ // the toolbar, is used as the parent of the edit control.
+ //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 (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);
+ if (!Globals.hStatusBar)
+ return FALSE;
+ CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
- }
+ // Create the status bar panes
+ SetupStatusBar(FALSE);
}
- // Create the status bar
- Globals.hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
- _T(""), Globals.hMainWnd, IDW_STATUS_WINDOW);
- if (!Globals.hStatusBar)
- return FALSE;
- CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
-
- // 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);
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);
-}
HWND hToolBar;
HWND hDriveBar;
HFONT hFont;
+ HWND hDriveCombo;
TCHAR num_sep;
SIZE spaceSize;
#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;
static WNetEnumResourceA_Ptr pWNetEnumResource;
static WNetOpenEnumA_Ptr pWNetOpenEnum;
-BOOL CheckNetworkAvailable(void)
+
+////////////////////////////////////////////////////////////////////////////////
+// Local module support methods
+//
+
+static BOOL CheckNetworkAvailable(void)
{
hMPR = LoadLibrary(_T("MPR.DLL"));
}
-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;
}
}
////////////////////////////////////
-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
- LPNETRESOURCE lpnrLocal; // pointer to enumerated structures
+ DWORD cbBuffer = 16384; // 16K is a good size
+ DWORD cEntries = -1; // enumerate all possible entries
+ LPNETRESOURCE lpnrLocal; // pointer to enumerated structures
DWORD i;
if (!bNetAvailable) return FALSE;
// 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
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"));
}
}
}
);
+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;
+}
+
#endif
-BOOL CheckNetworkAvailable(void);
+BOOL CreateNetworkMonitorThread(HWND hWnd);
+void SignalNetworkMonitorEvent(void);
+BOOL DestryNetworkMonitorThread(void);
+
DWORD MapNetworkDrives(HWND hWnd, BOOL connect);
#include "main.h"
#include "worker.h"
+#include "drivebar.h"
////////////////////////////////////////////////////////////////////////////////
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())