示例#1
0
static int OnCommand(HWND hDlg, UINT nNotify, UINT nIDCtrl)
{
    if(nNotify == BN_CLICKED)
    {
        switch(nIDCtrl)
        {
            case IDC_DIRECTORY_NAME_BROWSE:
                OnBrowseDirClick(hDlg);
                return TRUE;

            case IDC_FILE_NAME_BROWSE:
                OnBrowseFileClick(hDlg);
                return TRUE;

            case IDC_DESIRED_ACCESS_BROWSE:
                return OnDesiredAccessClick(hDlg);

            case IDC_FILE_ATTRIBUTES_BROWSE:
                return OnFileAttributesClick(hDlg);
        
            case IDC_SHARE_ACCESS_BROWSE:
                return OnShareAccessClick(hDlg);

            case IDC_TEMPLATE_FILE_BROWSE:
                OnBrowseTemplateClick(hDlg);
                return TRUE;

            case IDC_VIRTUALIZATION:
                return OnVirtualization(hDlg);

            case IDC_PRIVILEGES:
                PrivilegesDialog(hDlg);
                return TRUE;

            case IDC_MAKE_DIRECTORY:
                return OnMakeDirectoryClick(hDlg);

            case IDC_CREATE_FILE:
                return OnCreateFileClick(hDlg);

            case IDC_CLOSE_HANDLE:
                return OnCloseHandleClick(hDlg);
        }
    }

    return FALSE;
}
示例#2
0
static int OnCommand(HWND hDlg, UINT nNotify, UINT nIDCtrl)
{
    if(nNotify == BN_CLICKED)
    {
        switch(nIDCtrl)
        {
            case IDC_RELATIVE_FILE_HELP:
                return OnRelativeFileHelp(hDlg);

            case IDC_DIRECTORY_NAME_BROWSE:
                return OnBrowseDirClick(hDlg);

            case IDC_FILE_NAME_BROWSE:
                return OnBrowseFileClick(hDlg);

            case IDC_OBJ_ATTR_FLAGS_BROWSE:
                return OnObjAtributesFlags(hDlg);

            case IDC_DESIRED_ACCESS_BROWSE:
                return OnDesiredAccessClick(hDlg);

            case IDC_FILE_ATTRIBUTES_BROWSE:
                return OnFileAttributesClick(hDlg);
        
            case IDC_SHARE_ACCESS_BROWSE:
                return OnShareAccessClick(hDlg);

            case IDC_CREATE_OPTIONS_BROWSE:
                return OnCreateOptionsClick(hDlg);

            case IDC_EXTENDED_ATTRIBUTES_EDIT:
                return OnEditEaClick(hDlg);

            case IDC_VIRTUALIZATION:
                return OnVirtualization(hDlg);

            case IDC_PRIVILEGES:
                PrivilegesDialog(hDlg);
                return TRUE;

            case IDC_MAKE_DIRECTORY:
                return OnMakeDirectoryClick(hDlg);

            case IDC_RDWR_ASYNC:
                return QuickAccessSelection(hDlg, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, false);

            case IDC_RDWR_SYNC:
                return QuickAccessSelection(hDlg, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, true);

            case IDC_READ_ASYNC:
                return QuickAccessSelection(hDlg, GENERIC_READ, FILE_SHARE_READ, false);

            case IDC_READ_SYNC:
                return QuickAccessSelection(hDlg, GENERIC_READ, FILE_SHARE_READ, true);

            case IDC_QUERY_INFO_ASYNC:
                return QuickAccessSelection(hDlg, FILE_READ_ATTRIBUTES, 0, false);

            case IDC_QUERY_INFO_SYNC:
                return QuickAccessSelection(hDlg, FILE_READ_ATTRIBUTES, 0, true);

            case IDC_DELETE_ON_CLOSE:
                return QuickAccessSelection(hDlg, DELETE, 0, false);

            case IDC_CREATE_FILE:
                return OnCreateFileClick(hDlg);

            case IDC_CLOSE_HANDLE:
                return OnNtCloseClick(hDlg);
        }
    }

    // Convert the directory/file name to the NT name, if needed
    // Removed: Keep it as it is. We want to test NtCreateFile
    // with whatever the user entered.
//  if(nNotify == EN_KILLFOCUS)
//  {
//      if(nIDCtrl == IDC_DIRECTORY_NAME)
//          ConvertToNtName(hDlg, nIDCtrl);
//      if(nIDCtrl == IDC_FILE_NAME && GetWindowTextLength(GetDlgItem(hDlg, IDC_DIRECTORY_NAME)) == 0)
//          ConvertToNtName(hDlg, nIDCtrl);
//      return TRUE;
//  }

    return FALSE;
}