laurent
laurent

Reputation: 90736

Maximum path constant for an UNC path on Windows?

I know that for regular path I can use the MAX_PATH constant to create a string long enough to hold a path. However, how about UNC paths?

According to MSDN, I understand they can be up to 32,767 characters, so is there a constant defined for that? If not, is there any other way to create a string long enough for such paths? I know I can just hard-code it, but would like to avoid this, if possible.

Upvotes: 1

Views: 1012

Answers (2)

akame
akame

Reputation: 671

The constant UNICODE_STRING_MAX_CHARS is defined as 32767 in winnt.h.

Upvotes: 3

Mike Kwan
Mike Kwan

Reputation: 24447

I'm not sure this exists. If you look on the same page but a bit further down, you can see:

Note The maximum path of 32,767 characters is approximate, because the "\?\" prefix may be expanded to a longer string by the system at run time, and this expansion applies to the total length.

Upvotes: 1

Related Questions