|
Accessing the disk directly is not possible on NT-based machines. Goggle for HAL to see why/how it keeps non ring-0 applications from accessing the hardware. You can create a driver to do this, however, but that is not a trivial task.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
"directly" is ambigious, i think.
Under NT, it is much easier to access a hard disk than it is in Win 9x.
All you need to do is call the CreateFile() function with a "filename" of \\.\PHYSICALDRIVE0 for the first physical hdd and so on, or for logical drives: \\.\C:
You can read (not write), data using the ReadFile() function.
Writing would need a device driver.
Under 9x, you cannot use this method. You have to revrt to using the INT13 or INT13 Extended functions for the purpose. And that means writing a 16-bit VxD in VC++ 2.x or Borland C++.
Bikram Singh
|
|
|
|
|
hDriver = CreateFile("\\\\.\\physicaldrive0", ...) uses a generic symbolic link to get access to the driver that represents the first physical drive.
bikram singh wrote:
You can read ... data using the ReadFile() function.
Certainly you can. ReadFile(hDriver, &data, 512, &dwRead, NULL) will work just fine for reading the MBR of the first physical drive.
Access to PhysicalDrivexx devices is restricted to administrator-level accounts. To bypass HAL (e.g., virus scanner) would require a device driver.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
Certainly you can. ReadFile(hDriver, &data, 512, &dwRead, NULL) will work just fine for reading the MBR of the first physical drive.
It works for for any sector on the hard disk. Except the ones the hdd controller has marked as "bad" in it's cmos memory.
DavidCrow wrote:
Access to PhysicalDrivexx devices is restricted to administrator-level accounts. To bypass HAL (e.g., virus scanner) would require a device driver.
Thats true. Win some, lose some!
ps. have you worked on a FSFD? When I made mine, I was just so totally confused! The IFS DDK I dont have access to, so it was a really jittery experience!
Bikram Singh
|
|
|
|
|
bikram singh wrote:
It works for for any sector on the hard disk. Except the ones the hdd controller has marked as "bad" in it's cmos memory.
My bad. I read your earlier post as "You can not read..." which is why I was providing an example that showed otherwise. I'll need to not be so quick with my trigger finger!
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hello,
anyone knows if any libraries for creating a wav file (RIFF complaint) exists starting from an mp3 ( or even only creating it with audio-bytes in memory..
thanks
|
|
|
|
|
Hi,
MCI (Media Control Interface) is part of Windows SDK. You may
need to work with low-level MCI if you have to directly manipulate
raw audio-data. I am not sure if MCI supports MP3 files directly,
though.
Due Regards
Mahnedra
|
|
|
|
|
I need to check the IP address of all clients connecting to my server application.
Ive used the following code to accept client connection and to obtain its IP Address:
SOCKADDR l_ClientAddress;
m_pListeningSocket->Accept(l_TempSocket, &l_ClientAddress, &l_iClientAddressSize)
When I execute this code, I've problems to check to l_ClientAddress variable content: the sa_family field contains the number 2, but the sa_data field contains stange charactes....
How can I manage this variable ? I need to compare the client address with a string in the form xxx.xxx.xxx.xxx.....
Thank u very much !!!
|
|
|
|
|
Do the following:
<br />
SOCKADDR_IN addr_in = *(SOCKADDR_IN*)&l_ClientAddress;<br />
char *pIPAddress = inet_ntoa(addr_in.sin_addr);<br />
|
|
|
|
|
|
mancuso69 wrote:
...but the sa_data field contains stange charactes
And what do you think it should contain? As I understand it, that is an "input" member rather than an "output" member.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Dear All,
I am developing a dialog based application using MFC VC++ Version 6.0 for Windows 2000. The application consists of a TabControl derived from CTabCtrl Class having three tab pages in it. Also, the tabControl has Apply, Cancel , Ok button.
My query is how to disable "Apply" button on the click of an event on tab pages, i.e if on changing a selection of a given radio button in a tab page, the Apply button should become disabled.
Similiar case, like "Display properties" dialog box which appears upon right clicking on the desktop. When we select a background and click on apply or ok button to make the changes, the background color gets changed.
Please feel free to ask further clarifications in this regards,
Regards,
rajesh
|
|
|
|
|
You may call SetModified(FALSE);
Hope this helps,
D.
|
|
|
|
|
Hi all,
I made three buttons OK,Cancel and Apply.
I want to add code on apply button so that the basic functionalities works.
Codes have written below. Plz provide me some idea.
void CPreference::OnApply()
{
// TODO: Add your control notification handler code here
((CGeneralSettings*)m_tabMyTabCtrl.m_tabPages[0])->getSettings();
}
void CPreference::OnOk()
{
// TODO: Add your control notification handler code here
extern int tmpchkflag;
((CGeneralSettings*)m_tabMyTabCtrl.m_tabPages[0])->getSettings();
if(tmpchkflag) {
int iReturn = MessageBox("You must restart your computer before new settings will take effect.\nClose all applications and click OK to restart your computer.","EZ HDD Standard: Settings Change",MB_OK|MB_ICONQUESTION);
if (iReturn == IDOK) {
GivePrivilege();
if(!ExitWindowsEx(EWX_REBOOT| EWX_FORCE ,0)) {
MessageBox("Couldn't reboot! Please do it manually.", "EZ-Security Changed Settings", MB_OK);
}
}
CDialog::OnOK();
}
}
void CPreference::OnCancel()
{
// TODO: Add your control notification handler code here
CDisCardChanges dlg;
if(dlg.DoModal() == IDCANCEL)
CDialog::OnCancel();
}
rajesh
|
|
|
|
|
((CButton*)GetDlgItem(IDC_APPLYBUTTON))->EnableWindow(TRUE); <font style="color:green;">
TOXCCT >>> GEII power
|
|
|
|
|
I want to know how to hide the hint on the top of a column
|
|
|
|
|
I want to know how to hide the hint on the top of a column
|
|
|
|
|
Hi Dear,
I want to sort Item in isbn Search on AWS by its condition...
e.g: I specify mode=Used
but there r 4 type of used conditions:
1. Like New
2. Good
3. Very Good
4. Acceptable
I want to sort this 4 types..so that I can get min. of these four types.
means:
1. Like New===> Min. 10$
2. Good ===> Min. 4$
3. Vey Good ===>Min. 6$
4. Accepatble==>Min. 0.1$
Please help me finding out this info..
Thanks
---Sumit Kapoor---
|
|
|
|
|
Hi All,
I am trying to draw a Line in SDI Application.In fact I would like to Make a Line Function in SDi.As we know that MFC does not have a Line object class.
so, plz guide me "How to create Line in SDI application".
Rajesh
|
|
|
|
|
Hi,
WIN-API:
MoveToEx(...); //Point 1
LineTo(...); //Point 2
or MFC
CDC::MoveTo(...);
CDC::LineTo(...);
HTH
Frank
|
|
|
|
|
Like On-Screen Keyboard,I want my app don't get focus but still receving mouse input.
You can test On-screen keyboard in Windows XP,or 2k.
Because I use SendInput function to act on Windows Media Player,I must activate it when i click button on my app.Otherwise,my program itself receive my commands.And it's not the result i expect.
Please help me.I think much but i can't.
|
|
|
|
|
In the Window Procedure, do the following:
<br />
case WM_NCACTIVATE:<br />
return DefWindowProc(hWnd, message, (WPARAM)0, lParam);<br />
<br />
case WM_CREATE:<br />
SetWindowPos(hWnd, HWND_TOPMOST, 0,0,0,0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);<br />
Note: the first time the window is displayed, you would need to take away focus from it. after that, it should work as u need.
HTH
Bikram Singh
|
|
|
|
|
|
Thanks for the info!
I tried to use it, but it does not seem to work. Also, when i try and drag the window around, its "jumpy" - like when your CPU utilization is very high and you're trying to move a window...
Any idea about how to fix this problem?
Bikram Singh
|
|
|
|
|
Hi,
In my MDI application i am opening say some 5 MDI childs...I click on one of the child and this message is being send to some other application...From this second application my First MDI application receives a message which should be sent to the correct view on which i have clicked ..This view may not be the currently active view.How can i identify the correct view?
|
|
|
|