While this works in Windows 10, it isn't documented as belonging to kernel32.
The documentation says that this function lives in advapi32, so if you need to use this code on windows Vista, for instance, then you will need to correct this.
Additionally, as a stylistic issue, I would suggest consistently using the lowercase form for 'kernel32' and 'advapi32', rather than 'kernel32' and 'Advapi32'.
While this works in Windows 10, it isn't documented as belonging to kernel32.
The documentation says that this function lives in advapi32, so if you need to use this code on windows Vista, for instance, then you will need to correct this.
Additionally, as a stylistic issue, I would suggest consistently using the lowercase form for 'kernel32' and 'advapi32', rather than 'kernel32' and 'Advapi32'.
Please refer to https://msdn.microsoft.com/en-us/library/windows/desktop/aa379295%28v=vs.85%29.aspx