static int SaveDialog(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); HWND hCombo = GetDlgItem(hDlg, IDC_CREATE_DISPOSITION); int nError; GetDlgItemText(hDlg, IDC_DIRECTORY_NAME, pData->szDirName, _maxchars(pData->szDirName)); GetDlgItemText(hDlg, IDC_FILE_NAME, pData->szFileName1, _maxchars(pData->szFileName1)); if((nError = DlgText2Hex32(hDlg, IDC_OBJ_ATTR_FLAGS, &pData->dwObjAttrFlags)) != ERROR_SUCCESS) return nError; if((nError = DlgText2Hex32(hDlg, IDC_DESIRED_ACCESS, &pData->dwDesiredAccess)) != ERROR_SUCCESS) return nError; if((nError = DlgText2Hex32(hDlg, IDC_FILE_ATTRIBUTES, &pData->dwFileAttributes)) != ERROR_SUCCESS) return nError; if((nError = DlgText2Hex32(hDlg, IDC_SHARE_ACCESS, &pData->dwShareAccess)) != ERROR_SUCCESS) return nError; if((nError = DlgText2Hex32(hDlg, IDC_CREATE_OPTIONS, &pData->dwCreateOptions)) != ERROR_SUCCESS) return nError; if((nError = DlgText2Hex64(hDlg, IDC_ALLOCATION_SIZE, &pData->AllocationSize)) != ERROR_SUCCESS) return nError; pData->dwCreateDisposition2 = ComboBox_GetCurSel(hCombo); pData->bUseTransaction = (IsDlgButtonChecked(hDlg, IDC_TRANSACTED) == BST_CHECKED); return ERROR_SUCCESS; }
static int OnRelativeFileHelp(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); LPTSTR szBuffer; TCHAR szDesiredAccess[0x100]; TCHAR szShareAccess[0x100]; TCHAR szOpenOptions[0x100]; TCHAR szMsgFormat[512]; size_t cchBuffer = 0x1000; int nLength = 0; // Load both parts of the message nLength = LoadString(g_hInst, IDS_RELATIVE_FILE_HELP, szMsgFormat, _maxchars(szMsgFormat)); if(nLength > 0) { // Allocate big buffer for the entire text szBuffer = new TCHAR[cchBuffer]; if(szBuffer != NULL) { // Format the result string StringCchPrintf(szBuffer, cchBuffer, szMsgFormat, pData->dwDesiredAccessRF, FlagsToString(DesiredAccessValues, szDesiredAccess, _countof(szDesiredAccess), pData->dwDesiredAccessRF, false), pData->dwShareAccessRF, FlagsToString(ShareAccessValues, szShareAccess, _countof(szShareAccess), pData->dwShareAccessRF, false), pData->dwOpenOptionsRF, FlagsToString(CreateOptionsValues, szOpenOptions, _countof(szOpenOptions), pData->dwOpenOptionsRF, false)); // Display the message box MessageBoxRc(hDlg, IDS_INFO, (UINT_PTR)szBuffer); delete [] szBuffer; } } return TRUE; }
int NtUseFileId(HWND hDlg, LPCTSTR szFileId) { TFileTestData * pData = GetDialogData(hDlg); LPCTSTR szPlainName = szFileId + 3; HWND hWndParent = GetParent(hDlg); HWND hTabCtrl = GetDlgItem(hWndParent, IDC_TAB); // The file ID is expected in the format of "X:\################" if(szFileId[1] != _T(':') || szFileId[2] != _T('\\')) return ERROR_BAD_FORMAT; // The file ID must not contain special characters if(_tcschr(szPlainName, _T('\\')) || _tcschr(szPlainName, _T('/')) || _tcschr(szPlainName, _T(':'))) return ERROR_BAD_FORMAT; // Copy the directory name pData->szDirName[0] = szFileId[0]; pData->szDirName[1] = szFileId[1]; pData->szDirName[2] = szFileId[2]; pData->szDirName[3] = 0; // Copy the file id StringCchCopy(pData->szFileName1, _countof(pData->szFileName1), szPlainName); // Set the appropriate flags pData->dwCreateOptions = FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_BY_FILE_ID; // Switch to the "NtCreateFile" tab TabCtrl_SelectPageByID(hTabCtrl, MAKEINTRESOURCE(IDD_PAGE02_NTCREATE)); return ERROR_SUCCESS; }
static int OnApc(HWND hDlg, LPARAM lParam) { TWindowData * pData = GetDialogData(hDlg); TApcEntry * pApc = (TApcEntry *)lParam; // Perform APC-specific action if(pApc->ApcType == APC_TYPE_FSCTL) { // Show the result in the result UI SetResultInfo(hDlg, pApc->IoStatus.Status); // If the APC was an oplock APC, also show the result switch(pApc->UserParam) { case FSCTL_REQUEST_OPLOCK_LEVEL_1: case FSCTL_REQUEST_OPLOCK_LEVEL_2: case FSCTL_REQUEST_BATCH_OPLOCK: case FSCTL_REQUEST_FILTER_OPLOCK: OnCompleteOplockApc(pData, pApc); break; case FSCTL_REQUEST_OPLOCK: OnCompleteOplockApc_Win7(pData, pApc); break; } } return TRUE; }
void TaskDialog::OnSaveTaskDialog(wxCommandEvent& event) { size_t task_num = wxGetApp().getTaskManager()->GetTaskArray()->GetCount(); bool task_found = false; GetDialogData(); for(size_t index = 0; index < task_num; index++) { BotTask* target_task = wxGetApp().getTaskManager()->GetTaskArray()->Item(index); if(target_task->GetConfigFileName() == m_bottask->GetConfigFileName()) { task_found = true; m_bottask->WriteConfigData(); target_task->CloneTask(m_bottask); wxGetApp().getTaskManager()->RefreshList(); } } if(!task_found) { m_bottask->WriteConfigData(); wxGetApp().getTaskManager()->AddTask(m_bottask); wxGetApp().getTaskManager()->RefreshList(); } this->Close(); }
static int OnMoveOptions(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); FlagsDialog(hDlg, &pData->dwMoveFileFlags, IDS_MOVEFILE_FLAGS, MoveFileFlags); return TRUE; }
static int OnCopyOptions(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); FlagsDialog(hDlg, &pData->dwCopyFileFlags, IDS_COPYFILE_FLAGS, CopyFileFlags); return TRUE; }
static int OnUnmapViewClick(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); NTSTATUS Status; // Get the base address where it is mapped if(SaveDialog2(hDlg) == ERROR_SUCCESS) { // Unmap the view from the base address Status = NtUnmapViewOfSection(NtCurrentProcess(), pData->pvSectionMappedView); // Clear the base address, so the next click on "MapView" will succeed Hex2DlgTextPtr(hDlg, IDC_BASE_ADDRESS, NULL); pData->pvSectionMappedView = NULL; // Clear the view size, so the next click on "MapView" will succeed Hex2DlgTextPtr(hDlg, IDC_VIEW_SIZE, 0); pData->cbSectViewSize = 0; // Show the result SetResultInfo(hDlg, Status, pData->hSection); UpdateDialog(hDlg, pData); } return TRUE; }
static int OnDeleteFileClick(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); int nError = ERROR_SUCCESS; // Save the dialog variables SaveDialog(hDlg); // Choose what exactly to do switch(FileActionDialog(hDlg)) { case IDC_SIMPLE_DELETE: if(!DeleteFile(pData->szFileName1)) nError = GetLastError(); break; case IDC_FORCED_DELETE: nError = ForceRemoveFile(pData->szFileName1); break; default: return TRUE; } UpdateDialogButtons(hDlg); SetResultInfo(hDlg, nError); return TRUE; }
static int OnDeleteDirectoryClick(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); int nError = ERROR_SUCCESS; // Save the dialog variables SaveDialog(hDlg); // Choose what exactly to do switch(DirectoryActionDialog(hDlg)) { case IDC_SINGLE_DIRECTORY: if(!RemoveDirectory(pData->szFileName1)) nError = GetLastError(); break; case IDC_DIRECTORY_TREE: nError = RemoveDirectoryTree(pData->szFileName1); break; default: return TRUE; } SetResultInfo(hDlg, nError); return TRUE; }
static int OnGetFileAttributes(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); TFlagInfo * pFlags = FileAttributesValues; TCHAR szFileAttributes[512] = _T(""); DWORD dwAttr; int nError = ERROR_SUCCESS; SaveDialog(hDlg); dwAttr = GetFileAttributes(pData->szFileName1); if(dwAttr != INVALID_FILE_ATTRIBUTES) { for(int i = 0; pFlags->dwValue != 0; i++, pFlags++) { if(IS_FLAG_SET(pFlags, dwAttr)) { if(szFileAttributes[0] != 0) StringCchCat(szFileAttributes, _countof(szFileAttributes), _T("\n")); StringCchCat(szFileAttributes, _countof(szFileAttributes), pFlags->szFlagText); } } if(szFileAttributes[0] == 0) StringCchCopy(szFileAttributes, _countof(szFileAttributes), _T("0")); MessageBoxRc(hDlg, IDS_FILE_ATTRIBUTES, (UINT_PTR)szFileAttributes); } else nError = GetLastError(); SetResultInfo(hDlg, nError); return TRUE; }
static int OnDeltaPos(HWND hDlg, NMUPDOWN * pNMUpDown) { TFileTestData * pData = GetDialogData(hDlg); LONGLONG ByteOffset = 0; DWORD Length = 0; if(pNMUpDown->hdr.idFrom == IDC_BYTE_OFFSET_SPIN) { DlgText2Hex64(hDlg, IDC_BYTE_OFFSET, &ByteOffset); ByteOffset -= pNMUpDown->iDelta * 0x10000; if(ByteOffset < 0) ByteOffset = 0; Hex2DlgText64(hDlg, IDC_BYTE_OFFSET, ByteOffset); UpdateFileData(hDlg, NULL, pData->cbFileData, pData->FillPattern); } if(pNMUpDown->hdr.idFrom == IDC_LENGTH_SPIN) { DlgText2Hex32(hDlg, IDC_LENGTH, &Length); Length -= pNMUpDown->iDelta * 0x1000; if((int)Length < 0) Length = 0; Hex2DlgText32(hDlg, IDC_LENGTH, Length); UpdateFileData(hDlg, NULL, pData->cbFileData, pData->FillPattern); } return TRUE; }
static int OnApc(HWND hDlg, LPARAM lParam) { TFileTestData * pData = GetDialogData(hDlg); TApcReadWrite * pApc = (TApcReadWrite *)lParam; DWORD dwTransferred = 0; int nError = ERROR_SUCCESS; // Sanity check assert(pApc->ApcType == APC_TYPE_READ_WRITE); // Get the result of the operation and number of bytes transferred if(pApc->bNativeCall == false) { if(!GetOverlappedResult(pData->hFile, &pApc->Overlapped, &dwTransferred, TRUE)) nError = GetLastError(); } else { nError = RtlNtStatusToDosError(pApc->IoStatus.Status); dwTransferred = (DWORD)pApc->IoStatus.Information; } // Complete the read/write operation CompleteReadWriteOperation(hDlg, pApc, nError, dwTransferred); return TRUE; }
static void RefreshScreenSize(HWND hDlg) { TWindowData * pData = GetDialogData(hDlg); int nScreenHeight; int nDialogHeight; // Save the screen size SystemParametersInfo(SPI_GETWORKAREA, 0, &pData->ScreenRect, 0); GetWindowRect(hDlg, &pData->DialogRect); // Is the dialog higher than the screen? nScreenHeight = pData->ScreenRect.bottom - pData->ScreenRect.top; nDialogHeight = pData->DialogRect.bottom - pData->DialogRect.top; pData->bDialogBiggerThanScreen = (nDialogHeight > nScreenHeight); // If the dialog is bigger than the screen, set the timer if(pData->bDialogBiggerThanScreen) { if(pData->CheckMouseTimer == 0) { pData->CheckMouseTimer = SetTimer(hDlg, WM_TIMER_CHECK_MOUSE, 500, NULL); } } else { if(pData->CheckMouseTimer != 0) { KillTimer(hDlg, pData->CheckMouseTimer); pData->CheckMouseTimer = 0; } } }
static int OnDataEditor(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); if(SaveDialog2(hDlg) == ERROR_SUCCESS) DataEditorDialog(hDlg, pData->pvSectionMappedView, pData->cbSectViewSize); return TRUE; }
static int SaveDialog(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); if((pData->dwCreateOptions & FILE_OPEN_BY_FILE_ID) == 0) GetDlgItemText(hDlg, IDC_FILE_NAME1, pData->szFileName1, _maxchars(pData->szFileName1)); GetDlgItemText(hDlg, IDC_FILE_NAME2, pData->szFileName2, _maxchars(pData->szFileName2)); return ERROR_SUCCESS; }
static int OnMakeDirectoryClick(HWND hDlg) { OBJECT_ATTRIBUTES ObjAttr; IO_STATUS_BLOCK IoStatus = {0, 0}; UNICODE_STRING FileName; TFileTestData * pData = GetDialogData(hDlg); NTSTATUS Status = STATUS_SUCCESS; LPTSTR szDirectory = pData->szDirName; LPTSTR szPathPart = pData->szDirName; LPTSTR szTemp; USHORT SaveLength; // Get the values from dialog controls to the dialog data if(SaveDialog(hDlg) != ERROR_SUCCESS) return FALSE; // Initialize object attributes and the unicode string InitializeObjectAttributes(&ObjAttr, &FileName, OBJ_CASE_INSENSITIVE, NULL, NULL); RtlInitUnicodeString(&FileName, pData->szDirName); SaveLength = FileName.Length; // Now parse the directory as-is, create every sub-directory if(szDirectory[0] != 0) { // Now find the begin of the first directory part szPathPart = FindDirectoryPathPart(szDirectory); if(szPathPart != NULL) { while(szPathPart[0] != 0) { // Find either next backslash or end of string szTemp = FindNextPathSeparator(szPathPart); // Create the directory part FileName.Length = (USHORT)((szTemp - szDirectory) * sizeof(WCHAR)); Status = MyCreateDirectory(pData, &ObjAttr, &IoStatus); if(!NT_SUCCESS(Status)) break; // Go to the next part of the path FileName.Length = SaveLength; szPathPart = szTemp; } } else { Status = MyCreateDirectory(pData, &ObjAttr, &IoStatus); } } else { Status = MyCreateDirectory(pData, &ObjAttr, &IoStatus); } SetResultInfo(hDlg, Status, NULL, IoStatus.Information); return TRUE; }
static void OnNotify(HWND hDlg, NMHDR * pNMHDR) { TWindowData * pData; if(pNMHDR->code == TCN_SELCHANGE) { pData = GetDialogData(hDlg); pData->hWndPage = TabCtrl_GetSelectedPage(pNMHDR->hwndFrom); } }
static int OnSetEndOfFileClick(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); int nError = ERROR_SUCCESS; if(!SetEndOfFile(pData->hFile)) nError = GetLastError(); SetResultInfo(hDlg, nError); return TRUE; }
static int OnFlushFile(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); int nError = ERROR_SUCCESS; if(!FlushFileBuffers(pData->hFile)) nError = GetLastError(); SetResultInfo(hDlg, nError); return TRUE; }
static int OnNtCreateSectionClick(HWND hDlg, UINT nIDCtrl) { TFileTestData * pData = GetDialogData(hDlg); POBJECT_ATTRIBUTES pObjectAttributes = NULL; OBJECT_ATTRIBUTES ObjAttr; UNICODE_STRING SectionName; NTSTATUS Status; HANDLE FileHandle = NULL; // Close the section, if already open if(IsHandleValid(pData->hSection)) OnNtCloseClick(hDlg); // Get the values from dialog controls to the dialog data if(SaveDialog1(hDlg) != ERROR_SUCCESS) return FALSE; // Format the object attributes if(pData->szSectionName[0] != 0) { InitializeObjectAttributes(&ObjAttr, &SectionName, OBJ_CASE_INSENSITIVE, NULL, NULL); RtlInitUnicodeString(&SectionName, pData->szSectionName); pObjectAttributes = &ObjAttr; } // Get the file handle for it if(IsHandleValid(pData->hFile)) FileHandle = pData->hFile; // Either create a section or open one if(nIDCtrl == IDC_NTCREATE_SECTION) { Status = NtCreateSection(&pData->hSection, pData->dwSectDesiredAccess, pObjectAttributes, &pData->MaximumSize, pData->dwSectPageProtection, pData->dwSectAllocAttributes, FileHandle); } else { Status = NtOpenSection(&pData->hSection, pData->dwSectDesiredAccess, pObjectAttributes); } // Set the result info SetResultInfo(hDlg, Status, pData->hSection); UpdateDialog(hDlg, pData); return TRUE; }
static int OnMapViewClick(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); LARGE_INTEGER SectionOffset; NTSTATUS Status; SIZE_T ViewSize; PVOID BaseAddress; // If we have mapped view, unmap it now if(pData->bSectionViewMapped) OnUnmapViewClick(hDlg); // Get the values from dialog controls to the dialog data if(SaveDialog2(hDlg) != ERROR_SUCCESS) return FALSE; // Copy some values to stack SectionOffset.QuadPart = pData->SectionOffset.QuadPart; BaseAddress = pData->pvSectionMappedView; ViewSize = pData->cbSectViewSize; // Call the NtMapViewOfSection Status = NtMapViewOfSection(pData->hSection, NtCurrentProcess(), &BaseAddress, 0, pData->cbSectCommitSize, &SectionOffset, &ViewSize, ViewShare, pData->dwSectAllocType, pData->dwSectWin32Protect); if(NT_SUCCESS(Status)) { // If the section offset changed, set it to the dialog control if(SectionOffset.QuadPart != pData->SectionOffset.QuadPart) Hex2DlgText64(hDlg, IDC_SECTION_OFFSET, SectionOffset.QuadPart); if(BaseAddress != pData->pvSectionMappedView) Hex2DlgTextPtr(hDlg, IDC_BASE_ADDRESS, (ULONG_PTR)BaseAddress); if(ViewSize != pData->cbSectViewSize) Hex2DlgTextPtr(hDlg, IDC_VIEW_SIZE, ViewSize); // Remember the view pData->pvSectionMappedView = BaseAddress; pData->cbSectViewSize = ViewSize; pData->bSectionViewMapped = TRUE; } SetResultInfo(hDlg, Status, pData->hSection); UpdateDialog(hDlg, pData); return TRUE; }
static int OnSendAsynchronousFsctl( HWND hDlg, ULONG IoctlCode, PVOID InputBuffer = NULL, ULONG InputBufferSize = 0, PVOID OutputBuffer = NULL, ULONG OutputBufferSize = 0) { TFileTestData * pData = GetDialogData(hDlg); TApcEntry * pApc; NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES; // Create new APC entry pApc = (TApcEntry *)CreateApcEntry(pData, APC_TYPE_FSCTL, sizeof(TApcEntry) + OutputBufferSize); if(pApc != NULL) { // If there's an output buffer, move it to the APC structure if(OutputBuffer && OutputBufferSize) { memcpy(pApc + 1, OutputBuffer, OutputBufferSize); OutputBuffer = (pApc + 1); } // Send the FSCTL Status = NtFsControlFile(pData->hFile, pApc->hEvent, NULL, NULL, &pApc->IoStatus, IoctlCode, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize); // If the IOCTL returned STATUS_PENDING, it means that the oplock is active. // If the oplock breaks, the event becomes signalled, and we get the APC message if(Status == STATUS_PENDING) { pApc->UserParam = IoctlCode; InsertApcEntry(pData, pApc); } else { FreeApcEntry(pApc); } } SetResultInfo(hDlg, RtlNtStatusToDosError(Status)); return TRUE; }
static int OnSetActive(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); HANDLE FileHandle = IsHandleValid(pData->hFile) ? pData->hFile : NULL; // Either set NULL or the handle value if(FileHandle == NULL) SetDlgItemText(hDlg, IDC_FILE_HANDLE, _T("NULL")); else Hex2DlgTextPtr(hDlg, IDC_FILE_HANDLE, (DWORD_PTR)FileHandle); UpdateDialog(hDlg, pData); return TRUE; }
static int OnGetFileSizeClick(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); LARGE_INTEGER FileSize = {0}; int nError = ERROR_SUCCESS; // Get the file size SetLastError(ERROR_SUCCESS); FileSize.LowPart = GetFileSize(pData->hFile, (LPDWORD)&FileSize.HighPart); nError = GetLastError(); SetResultInfo(hDlg, nError, NULL, 0, &FileSize); return TRUE; }
static int OnMakeDirectoryClick(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); LPTSTR szDirectory = pData->szDirName; LPTSTR szPathPart = pData->szDirName; LPTSTR szTemp; TCHAR chSaveChar; int nError = ERROR_SUCCESS; // Get the values from dialog controls to the dialog data if(SaveDialog(hDlg) != ERROR_SUCCESS) return FALSE; // Now parse the directory as-is, create every sub-directory if(szDirectory[0] != 0) { // Now find the begin of the first directory part szPathPart = FindDirectoryPathPart(szDirectory); if(szPathPart != NULL) { while(szPathPart[0] != 0) { // Find either next backslash or end of string szTemp = FindNextPathSeparator(szPathPart); // Create the directory part chSaveChar = szTemp[0]; szTemp[0] = 0; nError = MyCreateDirectory(pData, szDirectory); if(nError != ERROR_SUCCESS) break; // Go to the next part of the path szPathPart = szTemp; szTemp[0] = chSaveChar; } } else { nError = MyCreateDirectory(pData, szDirectory); } } else { nError = MyCreateDirectory(pData, szDirectory); } SetResultInfo(hDlg, nError, pData->hFile); return TRUE; }
static int OnCommand(HWND hDlg, UINT nNotify, UINT nIDCtrl) { TFileTestData * pData; if(nNotify == BN_CLICKED) { switch(nIDCtrl) { case IDC_READ_FILE: case IDC_WRITE_FILE: case IDC_NTREAD_FILE: case IDC_NTWRITE_FILE: return OnReadWriteFile(hDlg, nIDCtrl); case IDC_LOCK_FILE: case IDC_UNLOCK_FILE: case IDC_NTLOCK_FILE: case IDC_NTUNLOCK_FILE: return OnLockUnlockFile(hDlg, nIDCtrl); case IDC_FILL_DATA: return ExecuteContextMenuForDlgItem(hDlg, IDC_FILL_DATA, IDR_DATA_PATTERN); case IDC_FILL_DATA_ZEROS: case IDC_FILL_DATA_PATTERN: case IDC_FILL_DATA_RANDOM: return UpdateFileData(hDlg, NULL, 0, nIDCtrl); case IDC_GET_FILE_SIZE: return OnGetFileSizeClick(hDlg); case IDC_SET_FILE_POINTER: return OnSetFilePointerClick(hDlg); case IDC_SET_END_OF_FILE: return OnSetEndOfFileClick(hDlg); } } if(nNotify == EN_KILLFOCUS) { if(nIDCtrl == IDC_BYTE_OFFSET || nIDCtrl == IDC_LENGTH) { pData = GetDialogData(hDlg); UpdateFileData(hDlg, NULL, pData->cbFileData, 0); } } return FALSE; }
// This function enables/disables the buttons for map operations static int UpdateDialogButtons(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); BOOL bEnable = IsHandleValid(pData->hFile) ? TRUE : FALSE; EnableDlgItems(hDlg, bEnable, IDC_FLUSH_FILE_BUFFERS, IDC_SET_SPARSE, IDC_REQUEST_OPLOCK_MENU, IDC_BREAK_ACKNOWLEDGE_1, IDC_REQUEST_OPLOCK_WIN7, IDC_BREAK_ACKNOWLEDGE_2, 0); return TRUE; }
static int OnNtCloseClick(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); NTSTATUS Status = STATUS_SUCCESS; // Close the handle if(IsHandleValid(pData->hSection)) Status = NtClose(pData->hSection); pData->hSection = NULL; // Set the result info SetResultInfo(hDlg, Status, pData->hSection); UpdateDialog(hDlg, pData); return TRUE; }
static int OnMoveFileClick(HWND hDlg) { TFileTestData * pData = GetDialogData(hDlg); int nError = ERROR_SUCCESS; SaveDialog(hDlg); // Perform the rename if(!MoveFileEx(pData->szFileName1, pData->szFileName2, pData->dwMoveFileFlags)) nError = GetLastError(); // Set the result SetResultInfo(hDlg, nError); return TRUE; }