But I want to create firewall rule which will route traffic coming from one user to loopback address 127.0.0.1 and route it to the IP address already bounded to that user not to just random IP address. Means I want to insert userid somehwere in this command to get the traffic for that specific id.
netsh command for firewall routing traffic for loopback address
SystemParametersInfo doesnt seem to work
Hi,
I was trying to disable all visual effects using the SystemParametersInfo api with this piece of code though it says succeeded in disabling i dont see any change in UI and also when i run this again it reports that its enabled going to disable. I am running this from admin prompt - still i see no change - is the way i am using this wrong or its not supposed to work this way? could someone please help?
BOOL fResult;BOOL res;
fResult = SystemParametersInfo(SPI_GETUIEFFECTS, 0, &res, 0);
if (fResult )
{
if (res)
{
cout << "GUI effects are enabled going to disable now..." << endl;
res = false;
fResult = SystemParametersInfo(SPI_SETUIEFFECTS, 0, &res, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
if (fResult)
cout << "Ui VE disabled successfully : " << GetLastError()<<endl;
else
cout << "Ui VE disabled UNsuccessfull: " << GetLastError()<<endl;
}}
Using wua api to scan for updates in offline using wsusscn2.cab file - but it always throwing E_ACCESSDENIED error in IUpdateServiceManager::AddScanPackageService function
I tried turning off call security using coInitializeSecurity..
Even though its not working
#include<Windows.h>
#include<iostream>
#include <wuapi.h>
#include <iostream>
#include <wuerror.h>
#pragma comment(lib,"wuguid.lib")
#pragma comment(lib,"OleAut32.lib")
#pragma comment(lib,"Ole32.lib")
using namespace std;
int main()
{
HRESULT hr;
hr = CoInitialize(NULL);
hr = CoInitializeSecurity(NULL,-1,NULL,NULL,RPC_C_AUTHN_LEVEL_NONE,RPC_C_IMP_LEVEL_IMPERSONATE,NULL,EOAC_NONE,NULL);
IUpdateServiceManager* iServiceManager=NULL;
IUpdateService* iService=NULL;
IUpdateSession* iUpdate=NULL;
IUpdateSearcher* searcher=NULL;
ISearchResult* results=NULL;
BSTR criteria = SysAllocString(L"IsInstalled=0");
hr = CoCreateInstance(CLSID_UpdateSession, NULL, CLSCTX_INPROC_SERVER, IID_IUpdateSession, (LPVOID*)&iUpdate);
hr = CoCreateInstance(CLSID_UpdateServiceManager,NULL,CLSCTX_INPROC_SERVER,IID_IUpdateServiceManager,(LPVOID *)&iServiceManager);
hr = iUpdate->CreateUpdateSearcher(&searcher);
wcout << L"Searching for updates ..."<<endl;
//throwing acces denied error in this function
hr=iServiceManager->AddScanPackageService(::SysAllocString(L"Offline Sync Service"),::SysAllocString(L"c:\\wsusscan.cab"),1,&iService);
hr= searcher->put_ServerSelection(ssOthers);
BSTR val;
hr=iService->get_ServiceID(&val);
hr = searcher->put_ServiceID(val);
hr = searcher->Search(criteria, &results);
SysFreeString(criteria);
switch(hr)
{
case S_OK:
wcout<<L"List of applicable items on the machine:"<<endl;
break;
case WU_E_LEGACYSERVER:
wcout<<L"No server selection enabled"<<endl;
return 0;
case WU_E_INVALID_CRITERIA:
wcout<<L"Invalid search criteria"<<endl;
return 0;
}
IUpdateCollection *updateList;
IUpdate *updateItem;
LONG updateSize;
BSTR updateName;
results->get_Updates(&updateList);
updateList->get_Count(&updateSize);
if (updateSize == 0)
{
wcout << L"No updates found"<<endl;
}
for (LONG i = 0; i < updateSize; i++)
{
updateList->get_Item(i,&updateItem);
updateItem->get_Title(&updateName);
wcout<<i+1<<" - "<<updateName<<endl;
}
::CoUninitialize();
wcin.get();
return 0;
}
UWP - Microsoft.Services.Store.Engagement - Powershell script will not install nuget package dependency
Microsoft.Services.Store.Engagement
Following your documentation found here:
https://docs.microsoft.com/en-us/windows/uwp/monetize/microsoft-store-services-sdk
I've added the NuGet version to my UWP app. The issue happens when you create the store package and try to install the app using the powershell script inside the appxbundle you get this error.
Deployment of package Microsoft.Services.Store.Engagement_10.0.18101.0_x64__8wekyb3d8bbwe was
blocked because the provided package has the same identity as an already-installed
package but the contents are different. Increment the version number of the package to be
installed, or remove the old package for every user on the system before installing this package.
I ran a Get-AppPackage Microsoft.Services.Store.Engagement
powershell
command and found that windows already has installed the engagement package at the windows level
Name : Microsoft.Services.Store.Engagement
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 10.0.18101.0
PackageFullName : Microsoft.Services.Store.Engagement_10.0.18101.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.Services.Store.Engagement_10.0.18101.0_x64__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.Services.Store.Engagement_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
This is critical to our QA/QC process which is broken by adding the store engagement nuget. We build the app bundle on jenkins and the QA/QC install the app using the powershell script. After adding the store engagement nuget no one is able to successfully install the app using the powershell script without hitting this error.
.Chris
Using of reference for commercial or scientific project
Can you help me to figure out, if I am able to use for free System.Speech.Synthesis and System.Speech.Recognition reference of Microsoft Windows 10 Pro OS in my WPF, UWP or WinForms commercial or scientific project desktop applications, or I have to buy some license.
I'm not sure, but if a license is necessary to use references in my personal project, and if Microsoft License Terms is what should answer my question, exactly, what specific license do I have to get, anyway, I can't figure out, how to use Microsoft License Terms in my particular case, because I'm using Microsoft Visual Studio Community 2015Microsoft.Net Framework on Windows 10 Pro OS.
I hope, using of references must be free for Windows OS user/developer, and If I understand it correctly Microsoft Copyrighted Content concerns cases when an using of Microsoft product goes beyond software development in a native environment, like in this topic. My using is a Windows desktop software development in native environment. It seems the System.Speech.Synthesis and System.Speech.Recognition not belong to the Visual Studio: Distributable Code for Microsoft Visual Studio 2017 (Includes Utilities, Extensibility, and BuildServer Files). logically references should be freely provided for development in the natural environment.
Are this tools someway different, for example, from "using System" or any other basic references in Microsoft OS, in terms of using for Windows OS personal software development. If yes, then what I have to do, to use it legally for personal commercial or scientific (non-commercial) Windows desktop application project.
Any advice or guide to find this information would be helpful
ShellExecute leaks handles
The following trivial program will result in around 400 leaked handles to dead processes, threads, and registry keys:
#include <windows.h> #include <cstdio> int main() { for (size_t i = 0; i < 100; ++i) { ::ShellExecute(nullptr, L"open", L"cmd.exe", L"/c dir", nullptr, SW_HIDE); } getchar(); return 0; }The underlying issue here appears to be in windows.storage.dll, according to error strings in onecoreuap\shell\windows.storage\execassoc.cpp. In particular, the CInvokeCreateProcessVerb object created in CBindAndInvokeStaticVerb::TryCreateProcessDdeHandler is never destroyed, because the associated reference count never reaches 0. This leaks all of the objects associated with CInvokeCreateProcessVerb, including 4 handles and some memory.
The reason the reference count never reaches 0 appears to be related to the argument change for ShellDDEExec::InitializeByShellInternal from Windows 10 1709 to 1803, executed by CInvokeCreateProcessVerb::Execute. It results in an AddRef that never gets released.
If this is not the right place to report such issues to the Windows team, please escalate or point me in the right direction.
Thanks!
What is the URL that downloads Windows Spotlight wallpapers?
Hello,
I want to download the Windows Spotlight wallpapers (Lock screen images) from Microsoft website, what is the URL? I do not want to get them from the folder "%localappdata%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"
Problem to port
Hi,
Now my server is not responding on port 993 and what to adjust, to this issue?
Many Thanks & Best Regards, Hua Min
download link(s) to Powershell Get-Help for all PS cmdlets
Peer Samie, Microsoft Community-Moderator, suggested I post this to MSDN, but without specifying a forum -- so, feel free to refer me as I probably got it wrong.
I need to use a Linux computer to download Powershell Get-Help for all PS cmdlets for later intallation to a Win10-1803 computer.
I need link(s) and, unless installation is obvious, I need installation instructions.
Warm Regards, and Much Thanks,
Mark.
PS: I need these a lot more than I need CandyCrushSodaSaga!
Where does kernel32.dll GetVersionEx() get its information from?
Hello,
Despite my protests, I've been tasked with installing an obsolete 10 year old application on Windows Server 2016. Unfortunately, the installer detects an incompatible Windows version and refuses to install the app. Since the customer absolutely needs to have the app AND Windows Server 2016, I need to somehow fool the installer into thinking that it's running on an older system.
I do not have the source code for the app (3rd party), nor does it contain the list of supported OS versions in any of the plaintext config files. It most likely doesn't extract the info into %TEMP% either (I checked there and found nothing) - and if it does, it does not do it in a human-readable way.
I know the app is old and written in Visual C++, so it's likely that it uses the GetVersionEx() function to obtain the version info. The installer log information it provides is also consistent with the output of this function.
My first question is: where does that information come from, and whether it is feasible to spoof the version somehow. In case the answer is negative, I'd like to know what other ways of achieving the goal might there be.
P.S. I tried compatibility mode - that didn't work.
Input Language Switch Appears on New Desktops
Overview
When creating a new desktop via the native Windows API and starting a Windows Forms or WPF application on it, Windows displays the Input Language Switch / Input Indicator as it e.g. also does when showing the UAC (for explanatory images, please refer to
the original post here: https://developercommunity.visualstudio.com/content/problem/288154/input-language-switch-appears-on-new-desktops.html).
Steps To Reproduce
- Run Windows Version 1803 or later
- Configure multiple input languages / keyboard layouts in the system settings
- Build the attached solution (see "Source Code") and copy the output from project "WindowsFormsApp" to the output folder of project "NewDesktopBug"
- Run project "NewDesktopBug"
- Enter a name for a new, temporary desktop and hit enter
- The new desktop should be activated with an empty form. In the lower right corner, the language switch should appear (see image below).
- Close the form -> the language switch should disappear
- After 10 seconds, the default desktop will be re-activated.
- Confirm with enter to terminate the application
Source Code
The Visual Studio solution linked below consists of two projects, "NewDesktopBug" which controls the desktop logic, and "WindowsFormsApp" which is an empty Windows Forms application. The relevant desktop logic is in the following two files: NewDesktopBug\Program.cs and NewDesktopBug\NativeMethods.cs.
https://developercommunity.visualstudio.com/storage/attachments/34161-newdesktopbug.zip
BluetoothLEDevice functionality in NuGet package consume by WPF application
I'm attempting to build a NuGet package that can be consumed by WPF applications that utilize the Windows libraries that contain BluetoothLEDevice
and
related classes. Existing applications that need this functionality are WPF applications and I don't quite understand what the limitations are around this. Currently, some things work while others do not.
For instance, I get a System.PlatformNotSupportedException:
'Windows Runtime (WinRT) is not supported on this platform.'
error when I use the device watcher to obtain a reference to the device I'm looking to connect to and then call DeviceInformation.CreateFromIdAsync(...)
.
- What should my NuGet package be targeting in terms of framework/standard version?
- What do the existing WPF applications have to target to be able to consume this?
I've tried setting the TargetPlatformVersion
to
10 for the WPF app. I also see different results depending on whether I reference my class library in the solution from a WPF project vs. loading it in as a NuGet package.
I'm having trouble finding recent documentation on this.
Jake
Problems Applying Advanced Query Syntax to DragDrop Extension handler
I'm not sure if this is even possible but I've been trying to limit a drag and drop extension handler
to only a specific folder:
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shellex\DragDropHandlers\DragDropExtension] @="{016673D5-9071-44E3-87EE-F99BB0E67122}""AppliesTo"="System.ItemPathDisplay:C:\\Users\\ej070\\Desktop\\test"but this seems to not work in my case. Is this feasible ? Or am i just going in the wrong directions?
dotnet core build command fails VS2017 with applocker error
Running in a domain with Applocker rules and getting this odd behavior:
running a command from VS command prompt works:
dotnet "someDLL" "someparams"
operates without failure.
However, running this same command as part of a build is failing with the following information:
A) Build script fails each time such a dotnet command is run with "This program is blocked by group policy. For more information, contact your system administrator."
B) AppLocker logs say "%OSDRIVE%\USERS\...\APPDATA\LOCAL\TEMP\TMP{GUID OR SOMETHING HERE}.EXEC.CMD was prevented from running" and is "blocked by MSI and SCRIPT" rule.
The fact that B is "dynamic" causes A to be problematic (as our security folks are unwilling/unable/other to add this to some exception list/rules of some kind), and I don't know enough about AppLocker to argue the point - other than dev's can't dev like this... which is met with stony silence...
I assume this is something to do with how VS does CMD process launches but its really annoying... Any thoughts/suggestions on how to work through this in a maintainable way?
I have also had a fair share of issues with the way the Roslyn compiler is done as a "\bin\Roslyn\" and have had to disable (so far have had success by removing Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers) to get things running with AppLocker...
This is MASSIVELY slowing us down from ACTUAL work... Is AppLocker just impossible for use with developers? Is there any guidance or information I can point to our security/infrastructure on this issue?
-- this is not the profile you're looking for --
Unable to install the Device Guard Code Integrity policies
I am unable to install the Device Guard Code Integrity policies.
I have already followed the instructions on renaming the desired policy file to SIPolicy.P7B, and copying it into the C:\Windows\System32\CodeIntegrity\
.
A pop-up appears stating:
Invalid Public Key Security Object File
This file is invalid for use as the following: PKCS #7
My machine's OS is Windows 10 Pro version 1803 (Build 17134.441)
Issues using remote WMI with later versions of Windows 10 / Windows 2019
I am currently writing an application to gather information from our customers for debugging and diagnosis purposes. The application uses remote WMI to gather selected device information.
While testing on various systems I discovered that I am unable to access systems running later versions of Windows 10 or Windows Server 2019. On both W-10 and W-2019 I receive the following exception when trying to connect using the ManagementScope:
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
at System.Management.ManagementScope.Initialize()
So far, I have been unable to find any explanation for this behavior.
Thanks in advance for any help anyone can provide...
UWF (Unified Write Filter) crashes reproduceable and not repairable in 4 Steps on Windows 10 Enterprise 1809 (also HYPER-V reproduceable)
Hello on Windows 10 Enterprise 1809 and Windows 10 Enterprise 2019 LTSC the UWF crash with the following 4 Steps reproduceable.
Execute Cmd as Admin:
-uwfmgr filter enable
-uwfmgr volume protect all
Reboot the system
Execute Cmd as Admin:
-uwfmgr filter disable
Reboot the system
Execute Cmd as Admin:
-uwfmgr filter reset-settings
After that the uwf crashes with the following message:
Error: Could not reset UWF Settings (Access is dienied)
From this point which each other uwfmgr command you get the same error, and it is not useable anymore!
It is also not possible to repair this behavior by disable "Unified Write Filter" under "Turn Windows feature on or off" in "Device Lockdown" group and enable it under a reboot again.
The error message above still occurs again.
This behavior is reproduceable with Windows 10 Enterprise 1809 and Windows 10 Enterprise 2019 LTSC also with the latest QFEs (Build 17763.194)
It can also reproduced in Hyper-V with Windows 10 Enterprise Evaluation Build 17764.rs5_release.180914-1434
With Windows 10 Enterprise 1803 this things works without any problems.
You can verify this also in Hyper-V with Windows 10 Enterprise Evaluation Build 17134.rs4_release.180410-1804
Please bring us as fast as possible a fix for this heavy bug!
RegisterClassA/ CreateWindowExA Fails with many threads
I have an application (say "A" ) in which I register a window class for the creation of window later on. Now I have another application ( say "B" ), which runs the former application "A" in multiple threads like suppose we provide n no. of threads, so the application "B" creates n processes and in each process it runs the application "A" where we register class and create window and do other stuff.
The issue is when I run B, specifying the number of threads to be around 30 or less, everything works fine and problem never comes. But, as soon as I increase the number of threads to 35 or any greater number ,things get weird, and I found during debugging that, in many runs of application A,
RegisterClassA was failing and returning NULL. Or,
When creating window later on ( using CreateWindowExA ), it returns NULL.
The main issue is that the problem never occurs with number of threads around 30 or less. And when we increase the number, the problem starts showing up, and the failure occurs in random runs of A, not all.
Does anyone have any idea if the number of threads has anything to do with these functions, or with creating these many processes at a time !
Also the RegisterClass happens with the same name everytime so could that be a problem ?
Edit:
A new finding!
The application B is run from command prompt, and we always run using admin rights. But when I run the cmd with 'non-admin' mode , none of the errors show up!
Surprising! Just debugging through the code! Will post here if anything substantial relatable to msdn is found!!
sample wrap existing provider not working in Windows7
I am working with credential provider samples available in github https://github.com/Microsoft/Windows-classic-samples/tree/master/Samples/Win7Samples/security/credentialproviders
I have just built the project using Visual Studio 2017 in Windows7.
Copied .dll to System32 dir and use Register.reg to deploy the respective CP.
All samples works except samplewrapexistingcredentialprovider.
The tile is not displayed in the login screen. No errors displayed. More than that, I didn't do any changes in the code.
How to find the process that opened the HID devices?
I wrote a program to open my HID-device failed. I can find the HID-device in DeviceManager, so I think there is some process that has opened the HID-device already. So is there any way to find the process that opened the HID-devices?