Answer the question
In order to leave comments, you need to log in
Why does it throw an error when getting the volume volume?
Hello, I'm doing lab work. You need to display the name of the volumes and their volume. For some reason, when calling GetDiskFreeSpaceEx(), the program stops and does not even give out the names of the next volumes. Even the last output "End" does not work. Tried running as administrator.
#include <windows.h>
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int WinVersion1 = (LOBYTE(LOWORD(GetVersion())));
int WinVersion2 = (HIBYTE(LOWORD(GetVersion())));
cout <<"Версия операционной системы: "<<WinVersion1<<"."<<WinVersion2;
char SystemDir[256];
GetSystemDirectory(SystemDir, 256);
cout <<"\nСистемный каталог: "<<SystemDir;
char PC_Name[256];
DWORD PC_NameSize;
PC_NameSize=sizeof(PC_Name);
GetComputerName(PC_Name,&PC_NameSize);
cout <<"\nНазвание компьютера: "<<PC_Name;
char UserName[256];
DWORD UserNameSize;
UserNameSize=sizeof(UserName);
GetUserName(UserName,&UserNameSize);
cout <<"\nИмя пользователя: "<<UserName;
char Volume[256];
char Path[256];
PULARGE_INTEGER Free;
PULARGE_INTEGER Total;
PULARGE_INTEGER TotalBytes;
cout<<"\n\nСписок томов:";
HANDLE search = FindFirstVolume(Volume, sizeof(Volume));
do {
cout <<"\n"<<Volume;
GetDiskFreeSpaceEx(Volume, Free, Total, TotalBytes); //
cout<<"\Общий объяем:\n"<<Total<<" Байт\nСвободного места:\n"<<Free<<" Байт";
}
while (FindNextVolume(search, Volume, sizeof(Volume)));
cout << "Конец";
}
Answer the question
In order to leave comments, you need to log in
For some reason, when calling GetDiskFreeSpaceEx(), the program stops
PULARGE_INTEGER Free; PULARGE_INTEGER Total; PULARGE_INTEGER TotalBytes; cout<<"\n\nСписок томов:"; HANDLE search = FindFirstVolume(Volume, sizeof(Volume)); do { cout <<"\n"<<Volume; GetDiskFreeSpaceEx(Volume, Free, Total, TotalBytes); //
ULARGE_INTEGER Free;
ULARGE_INTEGER Total;
ULARGE_INTEGER TotalBytes;
cout<<"\n\nСписок томов:";
HANDLE search = FindFirstVolume(Volume, sizeof(Volume));
do {
cout <<"\n"<<Volume;
GetDiskFreeSpaceEx(Volume, &Free, &Total, &TotalBytes); //
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question