Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Fix #20577: Add windows symbols #2940

Merged
merged 1 commit into from
Feb 13, 2020
Merged

Conversation

etcimon
Copy link
Contributor

@etcimon etcimon commented Feb 12, 2020

Merge of #2937 #2938 #2939

@etcimon etcimon requested a review from CyberShadow as a code owner February 12, 2020 00:03
@dlang-bot
Copy link
Contributor

dlang-bot commented Feb 12, 2020

Thanks for your pull request and interest in making D better, @etcimon! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
20577 enhancement Add missing symbols related to Windows UAC

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + druntime#2940"

@Geod24
Copy link
Member

Geod24 commented Feb 12, 2020

https://github.com/dlang/druntime/blob/master/CONTRIBUTING.md

Copy link
Member

@CyberShadow CyberShadow left a comment

Choose a reason for hiding this comment

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

Please maintain the style of the existing code in contributions.

Comment on lines 138 to 154
// set _WIN32_IE based on _WIN32_WINNT
static if (_WIN32_WINNT <= _WIN32_WINNT_NT4)
enum _WIN32_IE = _WIN32_IE_IE50;
else static if (_WIN32_WINNT <= _WIN32_WINNT_WIN2K)
enum _WIN32_IE = _WIN32_IE_IE501;
else static if (_WIN32_WINNT <= _WIN32_WINNT_WINXP)
enum _WIN32_IE = _WIN32_IE_IE60;
else static if (_WIN32_WINNT <= _WIN32_WINNT_WS03)
enum _WIN32_IE = _WIN32_IE_WS03;
else static if (_WIN32_WINNT <= _WIN32_WINNT_VISTA)
enum _WIN32_IE = _WIN32_IE_LONGHORN;
else static if (_WIN32_WINNT <= _WIN32_WINNT_WIN7)
enum _WIN32_IE = _WIN32_IE_WIN7;
else static if (_WIN32_WINNT <= _WIN32_WINNT_WIN8)
enum _WIN32_IE = _WIN32_IE_WIN8;
else
enum _WIN32_IE = 0x0A00;
Copy link
Member

Choose a reason for hiding this comment

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

I think we already have this here:

version (IE11) {
enum uint _WIN32_IE = 0xA00;
} else version (IE10) {
enum uint _WIN32_IE = 0xA00;
} else version (IE9) {
enum uint _WIN32_IE = 0x900;
} else version (IE8) {
enum uint _WIN32_IE = 0x800;
} else version (IE7) {
enum uint _WIN32_IE = 0x700;
} else version (IE602) {
enum uint _WIN32_IE = 0x603;
} else version (IE601) {
enum uint _WIN32_IE = 0x601;
} else version (IE6) {
enum uint _WIN32_IE = 0x600;
} else version (IE56) {
enum uint _WIN32_IE = 0x560;
} else version (IE55) {
enum uint _WIN32_IE = 0x550;
} else version (IE501) {
enum uint _WIN32_IE = 0x501;
} else version (IE5) {
enum uint _WIN32_IE = 0x500;
} else version (IE401) {
enum uint _WIN32_IE = 0x401;
} else version (IE4) {
enum uint _WIN32_IE = 0x400;
} else version (IE3) {
enum uint _WIN32_IE = 0x300;
} else static if (_WIN32_WINNT >= 0x500) {
enum uint _WIN32_IE = 0x600;
} else static if (_WIN32_WINNT >= 0x410) {
enum uint _WIN32_IE = 0x400;
} else {
enum uint _WIN32_IE = 0;
}

@@ -2257,7 +2257,8 @@ WINBASEAPI BOOL WINAPI SetEvent(HANDLE);
BOOL IsTextUnicode(PCVOID, int, LPINT);
BOOL IsValidAcl(PACL);
BOOL IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
BOOL IsValidSid(PSID);
BOOL IsValidSid(PSID);
BOOL CreateWellKnownSid(WELL_KNOWN_SID_TYPE, PSID, PSID, PDWORD);
Copy link
Member

Choose a reason for hiding this comment

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

Whitespace

@@ -2436,6 +2437,10 @@ struct TOKEN_USER {
}
alias TOKEN_USER* PTOKEN_USER;

struct TOKEN_MANDATORY_LABEL {
SID_AND_ATTRIBUTES Label;
Copy link
Member

@CyberShadow CyberShadow Feb 12, 2020

Choose a reason for hiding this comment

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

Whitespace. We use an indent of 4 spaces in D source code.

enum TOKEN_ELEVATION_TYPE {
TokenElevationTypeDefault = 1,
TokenElevationTypeFull,
TokenElevationTypeLimited
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

mak/WINDOWS Outdated
@@ -1202,6 +1202,9 @@ $(IMPDIR)\core\sys\windows\rpcnterr.d : src\core\sys\windows\rpcnterr.d

$(IMPDIR)\core\sys\windows\schannel.d : src\core\sys\windows\schannel.d
copy $** $@

Copy link
Member

@CyberShadow CyberShadow Feb 12, 2020

Choose a reason for hiding this comment

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

Please remove the tab character from this line. Trailing whitespace is not allowed by CI rules.

@etcimon etcimon force-pushed the add_symbols branch 4 times, most recently from 7c72c4d to e40186e Compare February 12, 2020 02:47
@@ -2257,7 +2257,8 @@ WINBASEAPI BOOL WINAPI SetEvent(HANDLE);
BOOL IsTextUnicode(PCVOID, int, LPINT);
BOOL IsValidAcl(PACL);
BOOL IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
BOOL IsValidSid(PSID);
BOOL IsValidSid(PSID);
Copy link
Member

Choose a reason for hiding this comment

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

Trailing whitespace, here and elsewhere (see CI log).

Copy link
Member

@CyberShadow CyberShadow left a comment

Choose a reason for hiding this comment

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

Diff LGTM but as previously mentioned in the other PRs, please improve the commit message. It should briefly describe the changes and mention a Bugzilla issue number. See @dlang-bot 's message above and the contributing guide for details.

@etcimon
Copy link
Contributor Author

etcimon commented Feb 12, 2020

I don't have a bugzilla number though, any chance I could get this merged anyways?

@CyberShadow
Copy link
Member

I don't have a bugzilla number though

Just create an issue. This is one of two ways that changes get publicly documented (which all non-trivial ones should be). The other way is generally left for bigger changes, as they get a better spot in the changelog.

any chance I could get this merged anyways?

No, but I can finish the rest for you if you like.

@etcimon
Copy link
Contributor Author

etcimon commented Feb 12, 2020

No, but I can finish the rest for you if you like.

To test this, I used the some D translation I made of this code: https://github.com/modzero/fix-windows-privacy/blob/master/fix-privacy-base/SelfElevate.cpp

How would I go making an issue without copying my D version of it?

@CyberShadow
Copy link
Member

The issue only needs to hold a short description of the goal that this PR aims to achieve. You could add more details such as your motivation for pursuing said goal, or include D code that currently doesn't work but you wish will work, but it's not necessary. The goal is that D users who read the changelog would have something to click and read in order to understand why the change was performed and what the benefit that it brought to D was.

@etcimon
Copy link
Contributor Author

etcimon commented Feb 12, 2020

The relevant issue has been added: https://issues.dlang.org/show_bug.cgi?id=20577

@etcimon etcimon changed the title Add windows symbols Fix #20577: Add windows symbols Feb 12, 2020
@CyberShadow
Copy link
Member

Great. Now you need to edit the commit message (not PR title/description) to reference the issue number. E.g. you could use:

Fix issue 20577 - Add missing symbols related to Windows UAC

@etcimon
Copy link
Contributor Author

etcimon commented Feb 12, 2020

Should I use the issue number in the commit description as well? Or just the title of the PR is fine?

Edit: nvm

@dlang-bot dlang-bot added the Enhancement New functionality label Feb 12, 2020
Copy link
Member

@CyberShadow CyberShadow left a comment

Choose a reason for hiding this comment

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

Nit, commit messages should be wrapped at 60-80 characters. (https://chris.beams.io/posts/git-commit/ and elsewhere)

Add extern(Windows) symbols and types related to Windows UAC
elevation and improve related types and enums.
@dlang-bot dlang-bot merged commit a581dc6 into dlang:master Feb 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Enhancement New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants