O que significa a seguinte notação: \\? \ c: \ mean?

2

Eu me lembro de alguém ter mencionado algo sobre a remoção de referência de um caminho, mas a remoção de referência não foi explicada e eu não sei o que é.

    
por Euretta Wilson 11.05.2017 / 23:28

2 respostas

2

É um caminho de comprimento estendido . Consulte MSDN: Nomeando arquivos, caminhos e espaços para nome

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. [...]

The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. [...] To specify an extended-length path, use the "\?\" prefix. For example, "\?\D:\very long path".

Basicamente, \?\ informa a API do Windows para passar o caminho diretamente para o sistema de arquivos sem manipulações adicionais. Além de estender o tamanho disponível, ele desativa a conversão automática de / para \ e também permite que você use os nomes de arquivos reservados . e .. . Veja o artigo relacionado acima para detalhes.

    
por 11.05.2017 / 23:39
2

O que significa o \?\c:\ ?

A primeira parte \?\ é chamada de prefixo de caminho de comprimento estendido. É usado para contornar as limitações da API do Windows no Tamanho máximo do caminho:

For file I/O, the "\?\" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system.

For example, if the file system supports large paths and file names, you can exceed the MAX_PATH limits that are otherwise enforced by the Windows APIs.

A segunda parte c:\ é uma referência ao caminho raiz da unidade c:.

Maximum Path Length Limitation

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters.

...

The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. This type of path is composed of components separated by backslashes, each up to the value returned in the lpMaximumComponentLength parameter of the GetVolumeInformation function (this value is commonly 255 characters).

To specify an extended-length path, use the "\?\" prefix. For example, "\?\D:\very long path".

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.

The "\?\" prefix can also be used with paths constructed according to the universal naming convention (UNC). To specify such a path using UNC, use the "\?\UNC\" prefix. For example, "\?\UNC\server\share", where "server" is the name of the computer and "share" is the name of the shared folder. These prefixes are not used as part of the path itself. They indicate that the path should be passed to the system with minimal modification, which means that you cannot use forward slashes to represent path separators, or a period to represent the current directory, or double dots to represent the parent directory. Because you cannot use the "\?\" prefix with a relative path, relative paths are always limited to a total of MAX_PATH characters.

Fonte Nomeando arquivos, caminhos e espaços para nomes

    
por 11.05.2017 / 23:44