Problem with include files

Robert Fetter 0 Reputation points
2023-05-01T16:48:47.5066667+00:00
I am running VS 2022

- - - - -

In C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\winbase.h:

typedef struct _FILE_REMOTE_PROTOCOL_INFO
{
    // Structure Version
    USHORT StructureVersion;     // 1 for Win7, 2 for Win8 SMB3, 3 for Blue SMB3.
    USHORT StructureSize;        // sizeof(FILE_REMOTE_PROTOCOL_INFO)

    ULONG  Protocol;             // Protocol (WNNC_NET_*) defined in winnetwk.h or ntifs.h.

    // Protocol Version & Type
    USHORT ProtocolMajorVersion;
    
- - - - - -

After running through the preprocessing pass of the compiler:


#line 9106 "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.22000.0\\um\\winbase.h"

typedef struct _FILE_REMOTE_PROTOCOL_INFO
{
    
    USHORT StructureVersion;     
    USHORT StructureSize;        

    ULONG  "protocol";             

    
    USHORT ProtocolMajorVersion;

!!!NOTE THE CHANGE FOR Protocol!!!

- - - - - -

This results in the following compile error:

C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\winbase.h(9113): error C2143: syntax error: missing ':' before 'string'

- - - - - -

   This is due to the fact that somewhere there is:
 #define Protocol "protocol"
   This is bad practice. Preprocessing definitions should be all upper case. If
   I were writing this I would have had:
 #define PROTOCOL_STR "protocol"
   and have used that as needed. Not following this style resulted in the error
   here. But what do I know, I'm just an old school programmer with over 40
   years of experience.

- - - - - -

  To get past this I cracked the file permissions and edited winbase.h changing
  'Protocol' to 'Protocol_'
  I didn't like doing this but there was no alternative.
  This resulted in a successful compilation.

- - - - - -

This should be corrected.

============================

Submitted with Visual Studio feedback. Got messge:

The status of a post on Developer Community has changed to Closed - Other Product

Ella Zhang [MSFT] has changed the status of Error in provided include file on Visual Studio Developer Community to Closed - Other Product.
Thank you for your feedback. We have determined that this issue belongs to the Windows platform. Please provide feedback using Windows 10 feedback hub store app. For more information, see https://support.microsoft.com/en-us/help/4021566/windows-10-send-feedback-to-microsoft-with-feedback-hub-app.
Happy coding!

But the  link provided did not work. Oh well.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,888 questions
{count} votes