Microsoft KB Archive/251427: Difference between revisions
(stage2) |
m (Text replacement - """ to """) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 25: | Line 25: | ||
== SYMPTOMS == | == SYMPTOMS == | ||
The '''GetDiskFreeSpaceEx''' function fails and the '''GetLastError''' function reports Error 123 when the '''GetDiskFreeSpaceEx''' function is called by using a directory name that contains more than a single period, such as | The '''GetDiskFreeSpaceEx''' function fails and the '''GetLastError''' function reports Error 123 when the '''GetDiskFreeSpaceEx''' function is called by using a directory name that contains more than a single period, such as "c:\v3.2.1" (assume that v3.2.1 exists).<br /> | ||
<br /> | <br /> | ||
If the '''GetDiskFreeSpaceEx''' function is called by using the short name (that is, | If the '''GetDiskFreeSpaceEx''' function is called by using the short name (that is, "c:\v32~1"), the problem still occurs. | ||
<br /> | <br /> | ||
Line 34: | Line 34: | ||
== RESOLUTION == | == RESOLUTION == | ||
To work around this problem, avoid using more than one period in a directory name. For example, replace periods in directory names with dashes. Instead of naming a directory | To work around this problem, avoid using more than one period in a directory name. For example, replace periods in directory names with dashes. Instead of naming a directory "v3.2.1", name the directory "v3_2_1". | ||
<br /> | <br /> | ||
Line 51: | Line 51: | ||
# Type '''md c:\v3.2.1''' at a command-line prompt. | # Type '''md c:\v3.2.1''' at a command-line prompt. | ||
# Run the sample code with the | # Run the sample code with the "c:\v3.2.1" parameter. Note that Error 123 is returned. | ||
# Run the code by using the short directory name (for example, | # Run the code by using the short directory name (for example, "c:\v32~1") and notice that Error 123 is returned in this case as well. | ||
==== Sample Code ==== | ==== Sample Code ==== | ||
<pre class="CODESAMP">#include | <pre class="CODESAMP">#include <windows.h> | ||
#include | #include <stdio.h> | ||
int main(int argc, char* argv[]) | int main(int argc, char* argv[]) | ||
Line 64: | Line 64: | ||
ULARGE_INTEGER ulUserSpace; | ULARGE_INTEGER ulUserSpace; | ||
ULARGE_INTEGER ulFreeSpace; | ULARGE_INTEGER ulFreeSpace; | ||
LPSTR lpDirectoryName = | LPSTR lpDirectoryName = "c:"; | ||
if(argc | if(argc > 1) | ||
lpDirectoryName = argv[1]; | lpDirectoryName = argv[1]; | ||
if(GetDiskFreeSpaceEx(lpDirectoryName, & | if(GetDiskFreeSpaceEx(lpDirectoryName, &ulUserSpace, &ulTotalSpace, &ulFreeSpace) == TRUE){ | ||
printf( | printf("User Space = %I64u\n", ulUserSpace.QuadPart); | ||
printf( | printf("Total Space = %I64u\n", ulTotalSpace.QuadPart); | ||
printf( | printf("Free Space = %I64u\n", ulFreeSpace.QuadPart); | ||
} | } | ||
else | else | ||
{ | { | ||
printf( | printf("error occurred %u\n", GetLastError()); | ||
} | } | ||
Latest revision as of 13:52, 21 July 2020
BUG: GetDiskFreeSpaceEx() Fails with Error 123 When it Is Passed a Subdirectory Containing Two (or More) Periods |
Q251427
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), included with:
- Microsoft Windows 95
- Microsoft Windows 98
- Microsoft Windows 98 Second Edition
SYMPTOMS
The GetDiskFreeSpaceEx function fails and the GetLastError function reports Error 123 when the GetDiskFreeSpaceEx function is called by using a directory name that contains more than a single period, such as "c:\v3.2.1" (assume that v3.2.1 exists).
If the GetDiskFreeSpaceEx function is called by using the short name (that is, "c:\v32~1"), the problem still occurs.
RESOLUTION
To work around this problem, avoid using more than one period in a directory name. For example, replace periods in directory names with dashes. Instead of naming a directory "v3.2.1", name the directory "v3_2_1".
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
MORE INFORMATION
Steps to Reproduce Behavior
- Type md c:\v3.2.1 at a command-line prompt.
- Run the sample code with the "c:\v3.2.1" parameter. Note that Error 123 is returned.
- Run the code by using the short directory name (for example, "c:\v32~1") and notice that Error 123 is returned in this case as well.
Sample Code
#include <windows.h> #include <stdio.h> int main(int argc, char* argv[]) { ULARGE_INTEGER ulTotalSpace; ULARGE_INTEGER ulUserSpace; ULARGE_INTEGER ulFreeSpace; LPSTR lpDirectoryName = "c:"; if(argc > 1) lpDirectoryName = argv[1]; if(GetDiskFreeSpaceEx(lpDirectoryName, &ulUserSpace, &ulTotalSpace, &ulFreeSpace) == TRUE){ printf("User Space = %I64u\n", ulUserSpace.QuadPart); printf("Total Space = %I64u\n", ulTotalSpace.QuadPart); printf("Free Space = %I64u\n", ulFreeSpace.QuadPart); } else { printf("error occurred %u\n", GetLastError()); } return 0; }
Additional query words:
Keywords : kbAPI kbFileIO kbKernBase kbOSWin95 kbOSWin98 kbDSupport kbGrpDSKernBase
Issue type : kbbug
Technology : kbAudDeveloper kbWin32sSearch kbWin32API
Last Reviewed: December 16, 2000 |