Posted on 2003-03-04
Medium Priority
Last Modified: 2013-12-03
When I put NULL in first Parameter I get names of all the DOS Devices on the system.

If the Buffer is smaller even then this succeeds and does not return a Error.

1) My questions is on What kind of system does The Buffer growes larger, May be say larger then 8192 Bytes.

Question by:AdityaKapoor
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 49

Expert Comment

ID: 8070484
>>What kind of system does The Buffer growes larger, May be say larger then 8192 Bytes.

Strange question, oddly worded.
I think you are asking if it would be possible for this function to return more than 8192 bytes.  I don't know the answer to that, but my system returns 5552 bytes, so it could easily be possible.

Perhaps you are asking if there is a way to determine if you have gotten all of the information, after all, there is no error message if your buffer is too small.  Here is how I would do it:

Start with a small buffer and, in a loop, keep calling, using a larger and larger buffer until the return value does not change twice in a row:

char* pBuf;
DWORD nLastSize= -1;
for (int j=1000; j< 100000; j+= 1000 ) {
    pBuf=new char[j];
    DWORD nRet= QueryDosDevice( 0, szBuff, j );
    if (nRet == 0 ) break; // and handle the error
    if ( nLastSize == nRet ) {
        break; // all done
    delete[] pBuf;  // get ready for next pass
    nLastSize == nRet;

Note: I did not test this code.

-- Dan

Author Comment

ID: 8076705
Hi Dan

I also thought twice or thrice how to frame the question but that was the best I could do that point in time

Actually I know that buffer could be more than 8192 bytes as I have seen system where this was 15000 bytes

As far as code was concerned my buffer was 8192 only for this system also. It actually wrote past the buffer successfully.

I came to know only at a latter point so it may happen that even when your size is 1000 in your code it will succeed and you wont get 0 as the return value as in my case.

I have here reworded the question
My question was not regarding the coding aspect it was rather theorytical .

"I wanted to know what actually governs NO of dosdevices on the system."
LVL 49

Accepted Solution

DanRollins earned 150 total points
ID: 8078418
From this article, it looks as if there is no particular limit:

    235128 - INFO: Understanding Device Names and Symbolic Links

since it is possible to create multiple aliases for any NT device.  

How do all of these devices end up in the list?  I'd say that they are put there during system setup and plug-and-play discovery -- each relates to some physical hardware attached to the system, such as disks, scanners, printer ports, sound cards, and so forth.

-- Dan

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question