First of all I would like to indicate that I am a newbie a programming. I am having a problem compiling a sample source code that I downloaded from microsoft. When I try to build the program I get an error that 'STORAGE_PROPER TY_QUERY' undeclared identifier. This structure is defined in the ntddstor.h file and is included. I dont understand why it does not see this structure.
OS: Windows XP, Visual C++ 6.0, latest SDK and changed the include and library directory order to have the SDK files first in the search order. Any ideas would be appreciated.
ErrorCode: c:\program files\microsoft visual studio\myprojec ts\programs that work\firstioctl \main.cpp|54|er ror C2065: 'STORAGE_PROPER TY_QUERY' : undeclared identifier| - /* The code of interest is in the subroutine GetDriveGeometry. The
-
code in main shows how to interpret the results of the call. */
-
-
#include <stdio.h>
-
#include <windows.h>
-
#include <winioctl.h>
-
#include <ntddstor.h>
-
-
BOOL GetDriveGeometry(DISK_GEOMETRY *pdg)
-
{
-
HANDLE hDevice; // handle to the drive to be examined
-
BOOL bResult; // results flag
-
DWORD junk; // discard results
-
-
-
-
-
-
-
hDevice = CreateFile(TEXT("\\\\.\\PhysicalDrive1"), // drive
-
0, // no access to the drive
-
FILE_SHARE_READ | // share mode
-
FILE_SHARE_WRITE,
-
NULL, // default security attributes
-
OPEN_EXISTING, // disposition
-
0, // file attributes
-
NULL); // do not copy file attributes
-
-
if (hDevice == INVALID_HANDLE_VALUE) // cannot open the drive
-
{
-
return (FALSE);
-
}
-
-
bResult = DeviceIoControl(hDevice, // device to be queried
-
IOCTL_DISK_GET_DRIVE_GEOMETRY, // operation to perform
-
NULL, 0, // no input buffer
-
pdg, sizeof(*pdg), // output buffer
-
&junk, // # bytes returned
-
(LPOVERLAPPED) NULL); // synchronous I/O
-
-
CloseHandle(hDevice);
-
-
return (bResult);
-
}
-
-
int main(int argc, char *argv[])
-
{
-
DISK_GEOMETRY pdg; // disk drive geometry structure
-
BOOL bResult; // generic results flag
-
ULONGLONG DiskSize; // size of the drive, in bytes
-
-
-
STORAGE_PROPERTY_QUERY query;
-
PSTORAGE_ADAPTER_DESCRIPTOR adpDesc;
-
PSTORAGE_DEVICE_DESCRIPTOR devDesc;
-
SCSI_PASS_THROUGH_WITH_BUFFERS sptwb;
-
-
-
-
bResult = GetDriveGeometry (&pdg);
-
-
if (bResult)
-
{
-
printf("Cylinders = %I64d\n", pdg.Cylinders);
-
printf("Tracks/cylinder = %ld\n", (ULONG) pdg.TracksPerCylinder);
-
printf("Sectors/track = %ld\n", (ULONG) pdg.SectorsPerTrack);
-
printf("Bytes/sector = %ld\n", (ULONG) pdg.BytesPerSector);
-
-
DiskSize = pdg.Cylinders.QuadPart * (ULONG)pdg.TracksPerCylinder *
-
(ULONG)pdg.SectorsPerTrack * (ULONG)pdg.BytesPerSector;
-
printf("Disk size = %I64d (Bytes) = %I64d (Gb)\n", DiskSize,
-
DiskSize / (1024 * 1024 * 1024));
-
}
-
else
-
{
-
printf ("GetDriveGeometry failed. Error %ld.\n", GetLastError ());
-
}
-
-
return ((int)bResult);
-
}
-
5 12537 gpraghuram 1,275
Recognized Expert Top Contributor
The other declarations after STORAGE_PROPERT Y_QUERY that is PSTORAGE_ADAPTE R_DESCRIPTOR is defined in the same header file?
If it is so check whether you have to include any specific definitions for that.
Better put the the header file also here so that i can take a look at it
Thanks
raghuram
Yes, those declarations are in the same "ntddstor.h " file. Except for the SCSI_PASS_THROU GH. I am having problems adding the code. I get an error that says I have to fill out the message and subject field. I attached the header file. Let me know if you have problems viewing the file. Thanks for your help.
gpraghuram 1,275
Recognized Expert Top Contributor
Yes, those declarations are in the same "ntddstor.h " file. Except for the SCSI_PASS_THROU GH. I am having problems adding the code. I get an error that says I have to fill out the message and subject field. I attached the header file. Let me know if you have problems viewing the file. Thanks for your help.
Can you please post the code instead of attaching the file.
Raghuram
Banfa 9,065
Recognized Expert Moderator Expert
I have removed the attachment, I'm sorry but you may not post the code of ntddstor.h here as it is Copyright to the Microsoft Corporation, we do not allow the posting of copyright code.
If the file contains the definition (which you can check for yourself) then it is something to do with they way in which it has been included. Please post your code containing your include statements.
Banfa
Administrator
Sorry for the copyright code file. The include statements are listed in the code at the beginning of this thread. They are; - #include <stdio.h>
-
#include <windows.h>
-
#include <winioctl.h>
-
#include <ntddstor.h>
-
Yes, the ntddstor. h has the definition for the STORAGE_PROPERT Y_QUERY structure. I don't know of another way to include this file. Any recommendations would be appreciated.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Saurabh Aggrawal |
last post by:
Hi,
if (iter->m_name.compare(pstrName) == 0)
{
// Provide our object.
*ppunkItem = iter->m_pUnknown;
// Addref our object...
iter->m_pUnknown->AddRef();
break;
}
|
by: craigbeanhead |
last post by:
Hi,
I'm teaching myself C from K&R2. I've come across something that I
really don't understand. When I try to compile the following code (in
VC++7), I get an "undeclared identifier" error. When I move the second
integer declaration to the beginning of the function, it compiles and
runs correctly. I'm sure I read that you could declare a variable
anywhere in a code block, as long as you don't attempt to use it
*before* the declaration....
|
by: Marc Gustafson |
last post by:
This function is executed when a application file is
double-clicked to open in a VC++ application.
Specifically, this function is enabled by
RegisterShellFileTypes () in the application's
InitInstance.
However, under MFC 7.1 for VC++ .NET 2003,
CFrameWnd::OnDDEExecute has a bug that repeatedly
generates this error message in the debugger
Error: failed to execute DDE command ''.
|
by: Stephanie Doherty |
last post by:
Hello World,
I am trying to use a _spawnl function like this (and I
have included the process.h file):
_spawnl(_P_WAIT,iporgfile,iporgfile,NULL);
It compiles with the following errors:
error C2065: '_P_WAIT' : undeclared identifier
|
by: Scott Chang |
last post by:
Hi All
I tried to use the attached OpenGL code to draw a Star-shaped figure on my Microsoft Visual C++ .NET 2002-Windows XP Pro PC. When I did 'Build' in Debug Mode, I got an error C2065: 'RenderScence': undeclared identifier. Please help and tell me (1) what it is wrong with my coding in this program and how to correct the problem, and (2) whether the functions/commands of the OpenGL v1.1 (existing in Microsoft Visual C++ .NET 2002) and GLUT...
| |
by: inkexit |
last post by:
I'm getting these two error mesages when I try to compile the below
source code:
error C2065: 'input_file' : undeclared identifier
error C2228: left of '.eof' must have class/struct/union type
The code below was snipped from a larger program for
anyone-who-might-want-to-help-me's convienience. That's why there are
varibales declared in the main that are not used in the program, and
why the main has such drastic indentation. However,...
|
by: teddarr |
last post by:
I am trying to construct a class with several functions and identifiers. The identifier in question is static double AIR which will hold the value of the annual interest rate in the class.
I have been getting an error message that I can't seem to get rid of:
error C2065: 'AIR' undeclared identifier
I have never worked with static identifiers before and I think I'm leaving something out somewhere but I don't know what.
Here's the...
|
by: Anna Smidt |
last post by:
Thanks for the help so far.
I have some problems left. One of them is an undeclared identifier, but
it's unclear to me why the compiler fights with me. It says
"iter: undeclared identifier"
I thought that the
identifier was clear: "int", or is int just the declaration, and the
identifier is something else?
Thanks a lot.
|
by: Harshini Raj |
last post by:
Hi,
I am unable to fix this error. Canyou tell me what compiler options i have to use to fix this issue?
Issue Error 40:Undeclared identifier 'Name' -- Within an expression, an identifier was encountered that had not previously been declared and was not followed by a left parenthesis. Name is the name of the identifier.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |