Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Support LongFile in the VM #2998

Merged
merged 1 commit into from
Feb 20, 2016
Merged

Support LongFile in the VM #2998

merged 1 commit into from
Feb 20, 2016

Conversation

ramarag
Copy link
Member

@ramarag ramarag commented Feb 3, 2016

I will have a series of commits in this PR (which I don't plan to merge until they are complete)

This First commit is to create Wrappers for the WIn32 APIs that take in a path.
The LongFile class provides various functionalities like path normalizations, tell if a path is relative etc.
The APIs which return a path are wrapped is such a way that they take an out parameter of type SString

@JeremyKuhne @JohnChen0 @gkhanna79 PTAL

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong copyright header.

#define WszGetBinaryType GetBinaryTypeWrapper

//Can not use extended syntax
#define WszGetFullPathName GetFullPathNameW
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/aa364963%28v=vs.85%29.aspx) says this function can use extended path syntax. Can you please elaborate on your comment?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/aa364963%28v=vs.85%29.aspx) says this function can use extended path syntax. Can you please elaborate on your comment?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetFullPathName can technically take extended syntax, but it doesn't handle it correctly. It roots the path at ?, which means ?\C:..\Foo becomes ?\Foo. In addition it is a little weird as ?\ is supposed to be fully resolved to begin with. Note that GetFullPathName takes > MAX_PATH for normal paths (verified on WinXP, but appears to go back even further).

@ramarag ramarag force-pushed the LongFileSupport branch 4 times, most recently from c03347c to dec50f2 Compare February 4, 2016 23:27

wcscpy_s(refRetVal->GetBuffer(), len + 1, dummy);
// Get the value Again.
newLen = WszGetEnvironmentVariable(strVar->GetBuffer(), dummy);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this now. In the original code we had to allocate the buffer first, and then get the environment variable. Now this is all done by WszGetEnvironmentVariable wrapper. Also don't need the surrounding while loop any more.

On the other hand, the if statement in GetEnvironmentVariableWrapper should really be a while loop, since the environment variable can be modified by another thread between two calls to GetEnvironmentVariableW.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it

@ramarag ramarag force-pushed the LongFileSupport branch 10 times, most recently from 9939847 to 56c68a8 Compare February 19, 2016 02:49
@ramarag
Copy link
Member Author

ramarag commented Feb 19, 2016

Private Desktop Testing is also clean
@JeremyKuhne @JohnChen0 @gkhanna79, can you sign off on the changes

@JeremyKuhne
Copy link
Member

I'm good with it.

@JohnChen0
Copy link

LGTM. Could you remove [WIP] from the PR title?

@gkhanna79
Copy link
Member

Thanks @ramarag. Was the CoreCLR DDR also clean?

They are:
1. Wrappers for OS APIs which  take or return PATHS

2. Fixing the usage of following Api's:

GetEnvironmentVariableW
SearchPathW
GetShortPathNameW
GetLongPathNameW
GetModuleFileName

Work remaining:
Remove fixed size buffers in the VM
@ramarag
Copy link
Member Author

ramarag commented Feb 20, 2016

The automated coreclr DDR are gone, I did a manual run it was clean

@ramarag ramarag changed the title [WIP]Support LongFile in the VM Support LongFile in the VM Feb 20, 2016
ramarag added a commit that referenced this pull request Feb 20, 2016
Initial Support  for LongFile in the VM
@ramarag ramarag merged commit 7045ca7 into dotnet:master Feb 20, 2016
@ramarag ramarag deleted the LongFileSupport branch June 11, 2016 03:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants