Fixed up makefile plus dependancies and now builds (and runs) with ros-tools.
svn path=/trunk/; revision=3315
TARGET = winfile
-BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400
-
-RCFLAGS = -DGCC -D_WIN32_IE=0x0400
+BASE_CFLAGS = -D_WIN32_IE=0x0400
+RCFLAGS = -D_WIN32_IE=0x0400
OBJS = about.o \
childwnd.o \
$(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
-about.o: about.c about.h resource.h
+main.h: resource.h makefile
+
+about.o: about.c about.h main.h
-main.o: main.c main.h childwnd.h framewnd.h resource.h
+main.o: main.c main.h childwnd.h framewnd.h main.h
-childwnd.o: childwnd.c childwnd.h resource.h
+childwnd.o: childwnd.c childwnd.h main.h
-framewnd.o: framewnd.c framewnd.h resource.h
+framewnd.o: framewnd.c framewnd.h main.h
-debug.o: debug.c debug.h
+debug.o: debug.c debug.h main.h
-font.o: font.c font.h
+font.o: font.c font.h main.h
-run.o: run.c run.h
+run.o: run.c run.h main.h
-setttings.o: setttings.c setttings.h resource.h
+setttings.o: setttings.c setttings.h main.h
-$(TARGET).o: $(TARGET).c $(TARGET).h resource.h
+$(TARGET).o: $(TARGET).c $(TARGET).h main.h makefile
clean:
--- /dev/null
+/*
+ * ReactOS winfile
+ *
+ * drivebar.c
+ *
+ * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifdef _MSC_VER
+#include "stdafx.h"
+#else
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#include <windows.h>
+#include <commctrl.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <memory.h>
+#include <tchar.h>
+#include <process.h>
+#include <stdio.h>
+#endif
+
+#include "main.h"
+#include "settings.h"
+#include "framewnd.h"
+#include "childwnd.h"
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Global Variables:
+//
+
+void ConfigureDriveBar(HWND hDriveBar)
+{
+ static DWORD dwLogicalDrivesSaved;
+ DWORD dwLogicalDrives = GetLogicalDrives();
+
+ if (!hDriveBar) return;
+
+ if (dwLogicalDrives != dwLogicalDrivesSaved) {
+ TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
+ int btn = 1;
+ PTSTR p;
+ int count = SendMessage(hDriveBar, TB_BUTTONCOUNT, 0, 0);
+ while (count) {
+ SendMessage(hDriveBar, TB_DELETEBUTTON, (WPARAM)--count, 0);
+ }
+ count = SendMessage(Globals.hDriveCombo, CB_GETCOUNT, 0, 0);
+ while (count) {
+// SendMessage(Globals.hDriveCombo, CB_DELETESTRING, (WPARAM)--count, 0);
+ }
+ SendMessage(Globals.hDriveCombo, CB_RESETCONTENT, 0, 0);
+
+ memset(Globals.drives, 0, BUFFER_LEN);
+ GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
+ drivebarBtn.fsStyle = TBSTYLE_BUTTON;
+ drivebarBtn.idCommand = ID_DRIVE_FIRST;
+ for (p = Globals.drives; *p;) {
+ // insert drive letter
+ TCHAR b[3] = { tolower(*p) };
+ SendMessage(hDriveBar, TB_ADDSTRING, 0, (LPARAM)b);
+ 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(hDriveBar, TB_INSERTBUTTON, btn, (LPARAM)&drivebarBtn);
+ drivebarBtn.idCommand++;
+ drivebarBtn.iString++;
+ while(*p++);
+//
+// SendMessage(Globals.hDriveCombo, CB_INSERTSTRING, btn, (LPARAM)b);
+// SendMessage(Globals.hDriveCombo, CB_ADDSTRING, 0, (LPARAM)b);
+// SendMessage(Globals.hDriveCombo, WM_SETTEXT, 0, (LPARAM)lpszWord);
+// SendMessage(Globals.hDriveCombo, CB_ADDSTRING, 0, (LPARAM)&b);
+//
+ ++btn;
+ }
+ dwLogicalDrivesSaved = dwLogicalDrives;
+
+// SendMessage(Globals.hDriveCombo, CB_SHOWDROPDOWN, (WPARAM)TRUE, (LPARAM)0);
+ }
+#ifndef __GNUC__
+
+ {
+ COMBOBOXEXITEM cbei;
+ int iCnt;
+
+ typedef struct {
+ int iImage;
+ int iSelectedImage;
+ int iIndent;
+ LPTSTR pszText;
+ } ITEMINFO, *PITEMINFO;
+
+#define MAX_ITEMS 15
+
+ ITEMINFO IInf[] = {
+ { 0, 3, 0, _T("first")},
+ { 1, 4, 1, _T("second")},
+ { 2, 5, 2, _T("third")},
+ { 0, 3, 0, _T("fourth")},
+ { 1, 4, 1, _T("fifth")},
+ { 2, 5, 2, _T("sixth")},
+ { 0, 3, 0, _T("seventh")},
+ { 1, 4, 1, _T("eighth")},
+ { 2, 5, 2, _T("ninth")},
+ { 0, 3, 0, _T("tenth")},
+ { 1, 4, 1, _T("eleventh")},
+ { 2, 5, 2, _T("twelfth")},
+ { 0, 3, 0, _T("thirteenth")},
+ { 1, 4, 1, _T("fourteenth")},
+ { 2, 5, 2, _T("fifteenth")}
+ };
+
+ for (iCnt = 0; iCnt < MAX_ITEMS; iCnt++) {
+
+ cbei.mask = CBEIF_TEXT | CBEIF_INDENT | CBEIF_IMAGE| CBEIF_SELECTEDIMAGE;
+ cbei.iItem = iCnt;
+ cbei.pszText = IInf[iCnt].pszText;
+ cbei.cchTextMax = sizeof(IInf[iCnt].pszText);
+ cbei.iImage = IInf[iCnt].iImage;
+ cbei.iSelectedImage = IInf[iCnt].iSelectedImage;
+ cbei.iIndent = IInf[iCnt].iIndent;
+ }
+
+
+ SendMessage(Globals.hDriveCombo, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
+ }
+#endif
+}
+
+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);
+}
+
--- /dev/null
+/*
+ * ReactOS Application Drivebar support routines
+ *
+ * drivebar.h
+ *
+ * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __DRIVEBAR_H__
+#define __DRIVEBAR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void ConfigureDriveBar(HWND hDriveBar);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // __DRIVEBAR_H__
// expand a directory entry
BOOL expand_entry(ChildWnd* child, Entry* dir)
{
- int idx;
+ int idx = 0;
Entry* p;
if (!dir || dir->expanded || !dir->down)
if (lpnmhdr->code == TBN_GETBUTTONINFO) {
LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lparam;
- char szBuffer[20];
+ TCHAR szBuffer[20];
// int tbButtonNew[20] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 };
TBBUTTON tbButtonNew[] = {
case TBN_GETBUTTONINFO:
{
LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lparam;
- char szBuffer[20];
+ TCHAR szBuffer[20];
/*
typedef struct _TBBUTTON {
int iBitmap;
{
#define DRIVEBOX_WIDTH 200
#define DRIVEBOX_HEIGHT 8
-
+/*
+typedef struct _TBBUTTON {
+ int iBitmap;
+ int idCommand;
+ BYTE fsState;
+ BYTE fsStyle;
+ DWORD dwData;
+ INT_PTR iString;
+} TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
+ */
TBBUTTON toolbarBtns[] = {
{DRIVEBOX_WIDTH+10, 0, 0, TBSTYLE_SEP},
{0, 0, 0, TBSTYLE_SEP},
// {1, ID_FILE_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_OPEN },
- {2, ID_FILE_MOVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_MOVE},
- {3, ID_FILE_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY},
- {4, ID_FILE_COPY_CLIPBOARD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY_CLIPBOARD},
- {5, ID_FILE_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_DELETE},
+// {2, ID_FILE_MOVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_MOVE},
+// {3, ID_FILE_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY},
+// {4, ID_FILE_COPY_CLIPBOARD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY_CLIPBOARD},
+ {5, ID_FILE_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{6, ID_FILE_RENAME, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{7, ID_FILE_PROPERTIES, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{8, ID_FILE_COMPRESS, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// 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
+ Globals.hDriveCombo = CreateWindowEx(0L, _T("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
HWND hWnd = (HWND)lpParameter;
// Create the event
- hNetworkMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, "Winfile Network Monitor Event");
+ hNetworkMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, _T("Winfile Network Monitor Event"));
// If we couldn't create the event then exit the thread
if (!hNetworkMonitorThreadEvent)
/*
- * ReactOS Application Debug Routines
+ * ReactOS Application Network support routines
*
* network.h
*
#include "run.h"
+typedef void (WINAPI *RUNFILEDLG)(
+ HWND hwndOwner,
+ HICON hIcon,
+ LPCSTR lpstrDirectory,
+ LPCSTR lpstrTitle,
+ LPCSTR lpstrDescription,
+ UINT uFlags);
+
+//
+// Flags for RunFileDlg
+//
+
+#define RFF_NOBROWSE 0x01 // Removes the browse button.
+#define RFF_NODEFAULT 0x02 // No default item selected.
+#define RFF_CALCDIRECTORY 0x04 // Calculates the working directory from the file name.
+#define RFF_NOLABEL 0x08 // Removes the edit box label.
+#define RFF_NOSEPARATEMEM 0x20 // Removes the Separate Memory Space check box (Windows NT only).
+
+
// Show "Run..." dialog
void OnFileRun(void)
{
void OnFileRun(void);
BOOL OpenTarget(HWND hWnd, TCHAR* target);
-typedef void (WINAPI *RUNFILEDLG)(
- HWND hwndOwner,
- HICON hIcon,
- LPCSTR lpstrDirectory,
- LPCSTR lpstrTitle,
- LPCSTR lpstrDescription,
- UINT uFlags);
-
-//
-// Flags for RunFileDlg
-//
-
-#define RFF_NOBROWSE 0x01 // Removes the browse button.
-#define RFF_NODEFAULT 0x02 // No default item selected.
-#define RFF_CALCDIRECTORY 0x04 // Calculates the working directory from the file name.
-#define RFF_NOLABEL 0x08 // Removes the edit box label.
-#define RFF_NOSEPARATEMEM 0x20 // Removes the Separate Memory Space check box (Windows NT only).
#ifdef __cplusplus
};
void LoadSettings(void)
{
HKEY hKey;
- char szSubKey[] = "Software\\ReactWare\\FileManager";
+ TCHAR szSubKey[] = _T("Software\\ReactWare\\FileManager");
/*
int i;
DWORD dwSize;
void SaveSettings(void)
{
HKEY hKey;
- char szSubKey1[] = "Software";
- char szSubKey2[] = "Software\\ReactWare";
- char szSubKey3[] = "Software\\ReactWare\\FileManager";
+ TCHAR szSubKey1[] = _T("Software");
+ TCHAR szSubKey2[] = _T("Software\\ReactWare");
+ TCHAR szSubKey3[] = _T("Software\\ReactWare\\FileManager");
// Open (or create) the key
hKey = NULL;
if (pSHFormatDrive) {
UINT OldMode = SetErrorMode(0); // Get the current Error Mode settings.
SetErrorMode(OldMode & ~SEM_FAILCRITICALERRORS); // Force O/S to handle
- pSHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
+ pSHFormatDrive(0/*hWnd*/, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
SetErrorMode(OldMode); // Put it back the way it was.
}
FreeLibrary(hShell32);
/*
- * ReactOS Application Debug Routines
+ * ReactOS Application Shell support routines
*
* shell.h
*
#include "windows.h"
#include "trace.h"
-DeclAssertFile; // Should be added at the begining of each .C/.CPP
-
#ifdef _DEBUG
#include <windowsx.h>
#include <shellapi.h>
#include <ctype.h>
-#include <assert.h>
-#define ASSERT assert
+//#include <assert.h>
+//#define ASSERT assert
#include "main.h"
#include "treeview.h"
HWND hWnd = (HWND)lpParameter;
// Create the event
- hMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, "Winfile Monitor Event");
+ hMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, _T("Winfile Monitor Event"));
// If we couldn't create the event then exit the thread
if (!hMonitorThreadEvent)