ReactOS 0.4.15-dev-7918-g2a2556c
vfdshprop.cpp File Reference
#include <windows.h>
#include <shellapi.h>
#include <shlobj.h>
#include <stdio.h>
#include "vfdtypes.h"
#include "vfdapi.h"
#include "vfdlib.h"
#include "vfdver.h"
#include "vfdmsg.h"
#include "vfdguirc.h"
#include "vfdshext.h"
Include dependency graph for vfdshprop.cpp:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 
#define VFD_PROPERTY_ID   "VFD"
 

Functions

static BOOL CALLBACK VfdPageDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
 
static UINT CALLBACK VfdPageCallback (HWND hWnd, UINT uMessage, LPPROPSHEETPAGE ppsp)
 
static void OnPropInit (HWND hDlg)
 
static void OnControl (HWND hDlg)
 
static void UpdateImageInfo (HWND hDlg, ULONG nDevice)
 

Macro Definition Documentation

◆ VFD_PROPERTY_ID

#define VFD_PROPERTY_ID   "VFD"

Definition at line 33 of file vfdshprop.cpp.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 11 of file vfdshprop.cpp.

Function Documentation

◆ OnControl()

void OnControl ( HWND  hDlg)
static

Definition at line 234 of file vfdshprop.cpp.

236{
237 CHAR module_path[MAX_PATH];
238 CHAR full_path[MAX_PATH];
240#ifndef __REACTOS__
241 DWORD ret;
242#else
244#endif
245
247 g_hDllModule, module_path, sizeof(module_path));
248
249 if (ret == 0 || ret >= sizeof(module_path)) {
250 file_name = full_path;
251 }
252 else {
254 module_path, sizeof(full_path), full_path, &file_name);
255
256 if (ret == 0 || ret >= sizeof(full_path)) {
257 file_name = full_path;
258 }
259 }
260
261 strcpy(file_name, "vfdwin.exe");
262
263 VFDTRACE(0, ("Starting %s\n", full_path));
264
265#ifndef __REACTOS__
267 hDlg, NULL, full_path, NULL, NULL, SW_SHOW);
268#else
270 hDlg, NULL, full_path, NULL, NULL, SW_SHOW);
271#endif
272
273 if (ret > 32) {
275 }
276 else {
279 }
280}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static LPCWSTR file_name
Definition: protocol.c:147
#define DWORD
Definition: nt_native.h:44
#define PSBTN_CANCEL
Definition: prsht.h:151
#define PropSheet_PressButton(d, i)
Definition: prsht.h:348
#define ShellExecute
Definition: shellapi.h:693
#define DWORD_PTR
Definition: treelist.c:76
char * PSTR
Definition: typedefs.h:51
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define VFDTRACE(LEVEL, STRING)
Definition: vfddbg.h:72
HINSTANCE g_hDllModule
PCSTR SystemMessage(DWORD nError)
Definition: vfdlib.c:147
#define VFD_MSGBOX_TITLE
Definition: vfdlib.h:53
int ret
#define GetModuleFileName
Definition: winbase.h:3831
#define GetFullPathName
Definition: winbase.h:3821
HWND WINAPI GetParent(_In_ HWND)
#define MessageBox
Definition: winuser.h:5822
#define MB_ICONSTOP
Definition: winuser.h:803
#define SW_SHOW
Definition: winuser.h:775
char CHAR
Definition: xmlstorage.h:175

Referenced by VfdPageDlgProc().

◆ OnPropInit()

void OnPropInit ( HWND  hDlg)
static

Definition at line 211 of file vfdshprop.cpp.

213{
214 // set up control text
215
218
219 SetControlText(hDlg, IDC_IMAGEFILE_LABEL, MSG_IMAGEFILE_LABEL);
220 SetControlText(hDlg, IDC_IMAGEDESC_LABEL, MSG_DESCRIPTION_LABEL);
221 SetControlText(hDlg, IDC_DISKTYPE_LABEL, MSG_DISKTYPE_LABEL);
222 SetControlText(hDlg, IDC_MEDIATYPE_LABEL, MSG_MEDIATYPE_LABEL);
223 SetControlText(hDlg, IDC_WRITE_PROTECTED, MSG_MENU_PROTECT);
224 SetControlText(hDlg, IDC_OPEN, MSG_OPEN_BUTTON);
225 SetControlText(hDlg, IDC_SAVE, MSG_SAVE_BUTTON);
226 SetControlText(hDlg, IDC_CLOSE, MSG_CLOSE_BUTTON);
227 SetControlText(hDlg, IDC_FORMAT, MSG_FORMAT_BUTTON);
228 SetControlText(hDlg, IDC_CONTROL, MSG_CONTROL_BUTTON);
229}
#define IDC_SAVE
Definition: resource.h:16
#define IDC_OPEN
Definition: resource.h:18
#define IDC_CLOSE
Definition: resource.h:52
#define IDC_PROPERTY_TITLE
Definition: vfdguirc.h:11
#define IDC_COPYRIGHT_STR
Definition: vfdguirc.h:12
#define IDC_MEDIATYPE_LABEL
Definition: vfdguirc.h:24
#define IDC_WRITE_PROTECTED
Definition: vfdguirc.h:26
#define IDC_DISKTYPE_LABEL
Definition: vfdguirc.h:20
#define IDC_CONTROL
Definition: vfdguirc.h:33
#define IDC_FORMAT
Definition: vfdguirc.h:32
#define IDC_IMAGEFILE_LABEL
Definition: vfdguirc.h:13
#define IDC_IMAGEDESC_LABEL
Definition: vfdguirc.h:15
void SetControlText(HWND hWnd, UINT nCtrl, DWORD nMsg)
Definition: vfdguiut.c:350
#define VFD_PRODUCT_DESC
Definition: vfdver.h:66
#define VFD_COPYRIGHT_STR
Definition: vfdver.h:69
#define SetDlgItemText
Definition: winuser.h:5849

Referenced by VfdPageDlgProc().

◆ UpdateImageInfo()

void UpdateImageInfo ( HWND  hDlg,
ULONG  nDevice 
)
static

Definition at line 285 of file vfdshprop.cpp.

288{
289 HANDLE hDevice;
291 VFD_DISKTYPE disk_type;
292 VFD_MEDIA media_type;
293 VFD_FLAGS media_flags;
296 DWORD attrib;
297 ULONG ret;
298
299 hDevice = VfdOpenDevice(nDevice);
300
301 if (hDevice == INVALID_HANDLE_VALUE) {
302 MessageBox(hDlg,
305 return;
306 }
307
308 // get current image information
309
311 hDevice,
312 buf,
313 &disk_type,
314 &media_type,
315 &media_flags,
316 &file_type,
317 &image_size);
318
319 CloseHandle(hDevice);
320
321 if (ret != ERROR_SUCCESS) {
322 MessageBox(hDlg,
325 return;
326 }
327
328 if (media_type == VFD_MEDIA_NONE) {
329
330 // drive is empty
331
336
342
345
347
348 return;
349 }
350
351 // display image file name
352
353 if (buf[0]) {
354 attrib = GetFileAttributes(buf);
355
356 if (attrib == INVALID_FILE_ATTRIBUTES) {
357 attrib = 0;
358 }
359 }
360 else {
361 if (disk_type != VFD_DISKTYPE_FILE) {
362 strcpy(buf, "<RAM>");
363 }
364 attrib = 0;
365 }
366
368
369 // display image description
370
371 VfdMakeFileDesc(buf, sizeof(buf),
372 file_type, image_size, attrib);
373
375
376 // display disk type
377
378 if (disk_type == VFD_DISKTYPE_FILE) {
379 SetDlgItemText(hDlg, IDC_DISKTYPE, "FILE");
380 }
381 else {
382 SetDlgItemText(hDlg, IDC_DISKTYPE, "RAM");
383 }
384
385 // display media type
386
388 VfdMediaTypeName(media_type));
389
390 // set write protect check box
391
392 if (media_flags & VFD_FLAG_WRITE_PROTECTED) {
394 }
395 else {
397 }
398
404
407
409}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
FD_TYPE file_type(FDSC **curr, char *fixed)
Definition: file.c:221
uint32_t ULONG
Definition: typedefs.h:59
void WINAPI VfdMakeFileDesc(PSTR pBuffer, ULONG nBufSize, VFD_FILETYPE nFileType, ULONG nFileSize, DWORD nFileAttr)
Definition: vfdguiut.c:376
DWORD WINAPI VfdGetImageInfo(HANDLE hDevice, PSTR sFileName, PVFD_DISKTYPE pDiskType, PVFD_MEDIA pMediaType, PVFD_FLAGS pMediaFlags, PVFD_FILETYPE pFileType, PULONG pImageSize)
Definition: vfdctl.c:1839
HANDLE WINAPI VfdOpenDevice(ULONG nTarget)
Definition: vfdctl.c:1215
PCSTR WINAPI VfdMediaTypeName(VFD_MEDIA nMediaType)
Definition: vfdctl.c:3280
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define IDC_IMAGEFILE_DESC
Definition: vfdguirc.h:16
#define IDC_DISKTYPE
Definition: vfdguirc.h:21
#define IDC_MEDIATYPE
Definition: vfdguirc.h:25
#define IDC_IMAGEFILE
Definition: vfdguirc.h:14
UCHAR VFD_FILETYPE
Definition: vfdtypes.h:62
UCHAR VFD_MEDIA
Definition: vfdtypes.h:61
UCHAR VFD_DISKTYPE
Definition: vfdtypes.h:60
@ VFD_MEDIA_NONE
Definition: vfdtypes.h:27
@ VFD_DISKTYPE_FILE
Definition: vfdtypes.h:18
#define VFD_FLAG_WRITE_PROTECTED
Definition: vfdtypes.h:68
UCHAR VFD_FLAGS
Definition: vfdtypes.h:63
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetFileAttributes
Definition: winbase.h:3815
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define SendMessage
Definition: winuser.h:5843
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BM_SETSTYLE
Definition: winuser.h:1924
#define BST_CHECKED
Definition: winuser.h:197

Referenced by VfdPageDlgProc().

◆ VfdPageCallback()

UINT CALLBACK VfdPageCallback ( HWND  hWnd,
UINT  uMessage,
LPPROPSHEETPAGE  ppsp 
)
static

Definition at line 60 of file vfdshprop.cpp.

64{
66
67 switch(uMessage) {
68 case PSPCB_CREATE:
69 return TRUE;
70
71 case PSPCB_RELEASE:
72 if (ppsp->lParam) {
73 ((LPCVFDSHEXT)(ppsp->lParam))->Release();
74 }
75 return TRUE;
76 }
77 return TRUE;
78}
HWND hWnd
Definition: settings.c:17
_In_ BOOLEAN Release
Definition: cdrom.h:920
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define PSPCB_CREATE
Definition: prsht.h:38
#define PSPCB_RELEASE
Definition: prsht.h:37
CVfdShExt * LPCVFDSHEXT
Definition: vfdshext.h:101

Referenced by CVfdShExt::AddPages().

◆ VfdPageDlgProc()

BOOL CALLBACK VfdPageDlgProc ( HWND  hDlg,
UINT  uMessage,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 84 of file vfdshprop.cpp.

92{
94 LPCVFDSHEXT lpcs;
95
96 switch (uMessage) {
97 case WM_INITDIALOG:
98#ifndef __REACTOS__
100#else
102#endif
103
104 if (lParam) {
106
107 OnPropInit(hDlg);
108 UpdateImageInfo(hDlg, lpcs->GetDevice());
109 }
110 return TRUE;
111
112 case WM_COMMAND:
113#ifndef __REACTOS__
115#else
117#endif
118
119 if (!psp) {
120 break;
121 }
122
123 lpcs = (LPCVFDSHEXT)psp->lParam;
124
125 if (!lpcs) {
126 break;
127 }
128
129 switch (wParam) {
130 case IDC_OPEN:
131 if (lpcs->DoVfdOpen(hDlg) == ERROR_SUCCESS) {
134 }
135 UpdateImageInfo(hDlg, lpcs->GetDevice());
136 break;
137
138 case IDC_SAVE:
139 if (lpcs->DoVfdSave(hDlg) == ERROR_SUCCESS) {
142 }
143 UpdateImageInfo(hDlg, lpcs->GetDevice());
144 break;
145
146 case IDC_CLOSE:
147 if (lpcs->DoVfdClose(hDlg) == ERROR_SUCCESS) {
150 }
151 UpdateImageInfo(hDlg, lpcs->GetDevice());
152 break;
153
155 lpcs->DoVfdProtect(hDlg);
156 break;
157
158 case IDC_FORMAT:
159 VfdGuiFormat(hDlg, lpcs->GetDevice());
160 break;
161
162 case IDC_CONTROL:
163 OnControl(hDlg);
164 break;
165 }
166 break;
167
168 case WM_CONTEXTMENU:
170 break;
171
172 case WM_HELP:
173 {
175
176 if (info->iContextType == HELPINFO_WINDOW) {
177 ShowHelpWindow(hDlg, info->iCtrlId);
178 }
179 }
180 return TRUE;
181
182 default:
183 if (uMessage == g_nNotifyMsg) {
184#ifndef __REACTOS__
186#else
188#endif
189
190 if (!psp) {
191 break;
192 }
193
194 lpcs = (LPCVFDSHEXT)psp->lParam;
195
196 if (!lpcs) {
197 break;
198 }
199
200 UpdateImageInfo(hDlg, lpcs->GetDevice());
201 }
202 break;
203 }
204
205 return FALSE;
206}
DWORD DoVfdProtect(HWND hParent)
Definition: vfdshmenu.cpp:493
ULONG GetDevice()
Definition: vfdshext.h:44
DWORD DoVfdOpen(HWND hParent)
Definition: vfdshmenu.cpp:459
DWORD DoVfdSave(HWND hParent)
Definition: vfdshmenu.cpp:475
DWORD DoVfdClose(HWND hParent)
Definition: vfdshmenu.cpp:484
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static VOID ShowContextMenu(HWND hwndDlg, HWND hwndTreeView, PHOTPLUG_DATA pHotplugData)
Definition: hotplug.c:110
if(dx< 0)
Definition: linetemp.h:194
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
DWORD WINAPI VfdGuiFormat(HWND hParent, ULONG nDevice)
Definition: vfdguiut.c:262
void ShowHelpWindow(HWND hDlg, UINT nCtl)
Definition: vfdguiut.c:507
UINT g_nNotifyMsg
static void UpdateImageInfo(HWND hDlg, ULONG nDevice)
Definition: vfdshprop.cpp:285
static void OnControl(HWND hDlg)
Definition: vfdshprop.cpp:234
static void OnPropInit(HWND hDlg)
Definition: vfdshprop.cpp:211
#define SetWindowLong
Definition: winuser.h:5853
#define DWLP_USER
Definition: winuser.h:872
struct tagHELPINFO * LPHELPINFO
#define WM_COMMAND
Definition: winuser.h:1740
#define DWL_USER
Definition: winuser.h:867
#define WM_INITDIALOG
Definition: winuser.h:1739
#define GetWindowLong
Definition: winuser.h:5796
#define HELPINFO_WINDOW
Definition: winuser.h:1172

Referenced by CVfdShExt::AddPages().