6 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
43 ////////////////////////////////////////////////////////////////////////////////
47 void ConfigureDriveBar(HWND hDriveBar
)
49 static DWORD dwLogicalDrivesSaved
;
50 DWORD dwLogicalDrives
= GetLogicalDrives();
52 if (!hDriveBar
) return;
54 if (dwLogicalDrives
!= dwLogicalDrivesSaved
) {
55 TBBUTTON drivebarBtn
= {0, 0, TBSTATE_ENABLED
, TBSTYLE_SEP
};
58 int count
= SendMessage(hDriveBar
, TB_BUTTONCOUNT
, 0, 0);
60 SendMessage(hDriveBar
, TB_DELETEBUTTON
, (WPARAM
)--count
, 0);
62 count
= SendMessage(Globals
.hDriveCombo
, CB_GETCOUNT
, 0, 0);
64 // SendMessage(Globals.hDriveCombo, CB_DELETESTRING, (WPARAM)--count, 0);
66 SendMessage(Globals
.hDriveCombo
, CB_RESETCONTENT
, 0, 0);
68 memset(Globals
.drives
, 0, BUFFER_LEN
);
69 GetLogicalDriveStrings(BUFFER_LEN
, Globals
.drives
);
70 drivebarBtn
.fsStyle
= TBSTYLE_BUTTON
;
71 drivebarBtn
.idCommand
= ID_DRIVE_FIRST
;
72 for (p
= Globals
.drives
; *p
;) {
73 // insert drive letter
74 TCHAR b
[3] = { tolower(*p
) };
75 SendMessage(hDriveBar
, TB_ADDSTRING
, 0, (LPARAM
)b
);
76 switch(GetDriveType(p
)) {
77 case DRIVE_REMOVABLE
: drivebarBtn
.iBitmap
= 1; break;
78 case DRIVE_CDROM
: drivebarBtn
.iBitmap
= 3; break;
79 case DRIVE_REMOTE
: drivebarBtn
.iBitmap
= 4; break;
80 case DRIVE_RAMDISK
: drivebarBtn
.iBitmap
= 5; break;
81 default:/*DRIVE_FIXED*/ drivebarBtn
.iBitmap
= 2;
83 SendMessage(hDriveBar
, TB_INSERTBUTTON
, btn
, (LPARAM
)&drivebarBtn
);
84 drivebarBtn
.idCommand
++;
85 drivebarBtn
.iString
++;
88 // SendMessage(Globals.hDriveCombo, CB_INSERTSTRING, btn, (LPARAM)b);
89 // SendMessage(Globals.hDriveCombo, CB_ADDSTRING, 0, (LPARAM)b);
90 // SendMessage(Globals.hDriveCombo, WM_SETTEXT, 0, (LPARAM)lpszWord);
91 // SendMessage(Globals.hDriveCombo, CB_ADDSTRING, 0, (LPARAM)&b);
95 dwLogicalDrivesSaved
= dwLogicalDrives
;
97 // SendMessage(Globals.hDriveCombo, CB_SHOWDROPDOWN, (WPARAM)TRUE, (LPARAM)0);
110 } ITEMINFO
, *PITEMINFO
;
115 { 0, 3, 0, _T("first")},
116 { 1, 4, 1, _T("second")},
117 { 2, 5, 2, _T("third")},
118 { 0, 3, 0, _T("fourth")},
119 { 1, 4, 1, _T("fifth")},
120 { 2, 5, 2, _T("sixth")},
121 { 0, 3, 0, _T("seventh")},
122 { 1, 4, 1, _T("eighth")},
123 { 2, 5, 2, _T("ninth")},
124 { 0, 3, 0, _T("tenth")},
125 { 1, 4, 1, _T("eleventh")},
126 { 2, 5, 2, _T("twelfth")},
127 { 0, 3, 0, _T("thirteenth")},
128 { 1, 4, 1, _T("fourteenth")},
129 { 2, 5, 2, _T("fifteenth")}
132 for (iCnt
= 0; iCnt
< MAX_ITEMS
; iCnt
++) {
134 cbei
.mask
= CBEIF_TEXT
| CBEIF_INDENT
| CBEIF_IMAGE
| CBEIF_SELECTEDIMAGE
;
136 cbei
.pszText
= IInf
[iCnt
].pszText
;
137 cbei
.cchTextMax
= sizeof(IInf
[iCnt
].pszText
);
138 cbei
.iImage
= IInf
[iCnt
].iImage
;
139 cbei
.iSelectedImage
= IInf
[iCnt
].iSelectedImage
;
140 cbei
.iIndent
= IInf
[iCnt
].iIndent
;
144 SendMessage(Globals
.hDriveCombo
, CBEM_INSERTITEM
, 0, (LPARAM
)&cbei
);
149 void _GetFreeSpaceEx(void)
152 TCHAR szDrive
[MAX_PATH
];
153 ULARGE_INTEGER i64FreeBytesToCaller
;
154 ULARGE_INTEGER i64TotalBytes
;
155 ULARGE_INTEGER i64FreeBytes
;
157 fResult
= GetDiskFreeSpaceEx(szDrive
,
158 (PULARGE_INTEGER
)&i64FreeBytesToCaller
,
159 (PULARGE_INTEGER
)&i64TotalBytes
,
160 (PULARGE_INTEGER
)&i64FreeBytes
);