Quantcast
Channel: General Windows Desktop Development Issues forum
Viewing all 6180 articles
Browse latest View live

Need help with adding command line into original .exe

$
0
0

Hi. I need help launching a application via VPN using Split Tunneling. The VPN client is not allowing me to select the shortcut file to launch the application. It always direct it to the original .exe file. The application cannot run without adding a command line in the "Target". When you go into properties on the short cut file there is a "Target:" and at the end there is an extra line which the original .exe does not have. I try to add this line to the original .exe but there is no option for me to do it like you for the shortcut file. 

Does anyone know how I could add a command line to the original .exe so that the VPN client could launch the original .exe file with the command line added?

Example;

Target: c:\programs\xxxx\xxxx.exe -xxxxxxxxxx SHORTCUT file

Location: c:\programs\xxxx\xxxx.exe ORIGINAL file. <---- Does not have option to let you add anything

I want the original file look the same as the shortcut file so I will be able to launch the app.


Return custom objects using SAFEARRAY

$
0
0

I have an interface defines as IMyInterface : IDispatch and another interface with the method

[id(1)] HRESULT GetMyObjects ( [out, retval] SAFEARRAY(IMyInterface*) * ppMyObjects) ;

In C++ code the method is defined as

STDMETHOD

( GetMyObjects) (/*[out, retval]*/SAFEARRAY**ppMyObjects) ;

and implemented as

CComSafeArray<IDispatch*>MyObjects(m_MyObjects.size() ) ;

intn= 0 ;

for(MYOBJECTMAP::iteratorit=m_MyObjects.begin() ; it!=m_MyObjects.end() ; it++)

{

IDispatch * pObj=it->second;

MyObjects[n++]= pObj;

}

*

ppMyObjects=MyObjects.Detach() ;

I expect PowerShell to enumerate methods and properties of my object using IDispatch interface. However, it doesn't.

For my root object created using new-object - com PowerShell reports class GUID:

TypeName: System.__ComObject#{202a8905-51bb-454b-8446-34daa7194db4}

For the objects I return PowerShell only reports System.__ComObject andGEt-Member report looks weird:

TypeName: System.__ComObject

Name                      MemberType Definition                                                    
----                      ---------- ----------                                                    
CreateObjRef              Method     System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)
Equals                    Method     bool Equals(System.Object obj)                                
GetHashCode               Method     int GetHashCode()                                             
GetLifetimeService        Method     System.Object GetLifetimeService()                            
GetType                   Method     type GetType()                                                
InitializeLifetimeService Method     System.Object InitializeLifetimeService()                     
ToString                  Method     string ToString()     

What can be the reason?

Windows 10 - Script to reset - SCCM

$
0
0

Hi,

We are looking at managing Windows 10 with our SCCM 2012 environment. One of the features of Windows 10 is that it can be managed via an MDM platform which brings with it the ability to remote reset.

What I would like to know is if anyone has found a way to do a remote reset using a script like PowerShell? We already have an MDM and are not looking at SCCM 2016 with on prem MDM features just yet.

Thank you.

Alan

How to define a logical drive letter for a service?

$
0
0

(Sorry for the cross-posting but in the other forum it was suggested that this might be a better suited forum for this question).

We have developed an application that runs as a service. In order to simplify the configuration we use a logical drive letter "W:" (for "workspace") that needs to point to a special directory where the app finds its configuration files and can deposit temp. files, etc. In different environments this drive letter points to some local directory, a separate disk, a directory on a NAS, etc.

This setup worked fine so far in all environments (Windows 7, 8.1, 10, Windows Server 2008) but it fails on Windows Server 2012. If I start the application manually it works all fine. If it gets started as a service it finds no "W:" drive.

Normally I define this drive "W:" using

 net use W: \\localhost\C$\XYZ_Workspace /persistent:yes

After that one has to reboot and all is fine. But under Windows 2012 it seems that the process running the service gets started before that drive assignments happens. \

I tried misc. things so far:
 * I changed the service startup-mode to "Automatic (Delayed)"
 * I ran the above "net use ..." as user "Administrator" and as user "nt authority\system".
 * I defined logon scripts for user Adminstrator that executed "net use ..." or "subst W: C:\XYZ_Workspace" to define the drive letter. I didn't find any place where to put a logon script for user "system" - is there any?
 * I defined a "W-Drive" entry under the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run executing the above "net use ..." command and also tried with "subst W: C:\XYZ_Workspace" command.

None of the above helped. The drive letter remains invisible to the service and thus its startup fails!

Now I ran out of ideas, how I can define a drive letter BEFORE a service starts?

Any idea or advice?

How to get bitmap using Desktop Duplication API?

$
0
0

I have used Desktop Duplication API (using this example - https://code.msdn.microsoft.com/windowsdesktop/Desktop-Duplication-Sample-da4c696a) and obtained a ID3D11Texture2D object. 

I want to try and obtain a bitmap of it, or a pixel array or save it to an image. I have tried SaveTextureToFile, SaveWICTextureToFile but both of them return with error. I have also tried copying the texture to a subresource and axessing the pData member, but it seems to be filled with 0s.

Is there any other way to obtain a bitmap after acquiring the next frame?

Application fails to start in Windows 10 home but is fine in every other version

$
0
0

Bit of a random one. I have been informed of an issue with my application where the installer would hang on finish and seemingly not install anything despite claiming success on Windows 10 home edition.

Every other iteration appears to work as expected without incident.

Application is built in;

C#
Windows forms
.Net targeted at 4.5
third party driver (installs fine when run alone)

So far I've tested in(64bit);

Vista Home/Business
7 Home Basic&Premium/Pro/Ultimate
8 Basic/Pro
8.1 Basic/Pro
10 Home/Pro
(All clean builds)

The app fails to start, running in compatibility mode doesn't help.

I've looked through the comparison charts of Home and Pro but nothing stands out that could cause this.

Can anyone think of a reason Windows 10 Home edition would be different?

Or know of any tools to catch the issue that's causing this? Windows event viewer doesn't appear to notice anythings happened.

Please help me wise ones.



I should add this is my first Windows desktop application so I apologise if I'm missing a rookie thing.

WebBrowser Control with IPersistStreamInit, broken in 14251

$
0
0

Hey Guys,

I have an application which uses MSHTML WebBrowser Control (IWebBrowser2) to render content using the IPersistStreamInit method described here: https://msdn.microsoft.com/en-us/library/aa752047%28v=vs.85%29.aspx#Query

Since upgrading to 14251, the rendering no longer works. Has anyone else encountered this problem?

[MFC] Ext. DLL object unable to read memory

$
0
0

I have an Extension DLL being used by an MFC application. For some reason, I keep getting error like this

Access violation readin location 0xCDCDCDE9

The line where the exception occurs is right here.

bool TBorder::onCreate(RECT l)
{
	if (!rt)    // error! unable to read memory
		return false;

	rt->CreateSolidColorBrush(color, &brush);



	return true;
}

This is odd because this is the constructor that was used

TBorder::TBorder(ID2D1RenderTarget *rtp, TControl *tc)
{
	rt = rtp;
	cap = tc;
}

Here is a small version of TControl

class _ANAFACE_DLL TControl
{
public:
	TControl(ID2D1RenderTarget*, TArray<styleTable>*);
	TControl(ID2D1RenderTarget*);
	TControl();
	~TControl();

	virtual bool onCreate(RECT);
	bool onScroll(int x, int y);
	void ondraw();

//protected:
;
	RECT location, snip, margin;
	bool vScroll, hScroll;
	ID2D1Factory* factory;
	ID2D1RenderTarget* renderTarget;
	TControl* parent;
	TBorder* border1, *border2;
	TText* text1, *text2;
	TContent* content1, *content2;

	bool onCreate(TMap<TString>*);
};

and the TBorder Class

class _ANAFACE_DLL TBorder
{
	friend class TControl;
public:
	TBorder(ID2D1RenderTarget*, TControl*);
	TBorder();
	~TBorder();

	bool onCreate(RECT);
	void onDraw();
private:


	ID2D1SolidColorBrush* brush;
	float thickness = 1.0f;
	CString style;
	D2D1::ColorF color = D2D1::ColorF(D2D1::ColorF::Black, 1.0);
	ID2D1RenderTarget* rt;
	ID2D1Image* image;
	int storeInTML(CArchive* ar, int childLevel);
	TControl* cap;
};

When the error does appear, TBorder has these properties:

A bunch of unable to read memory attributes

The "renderTarget" attribute in TControl should be the same as the "rt" attribute in TBorder.


Windows Restart Manager API in Windows 8.1 and Windows 10

$
0
0

I am actually trying to write a demo program which will use restart manager to cause a machine restart and on load open up calc.exe. What I am actually trying to see is whether the RMRestart method actually starts up my machine and launches calc.exe on next launch.

This is code I have written -

// TestRestartManager.cpp : Defines the entry point for the console application.

#include "stdafx.h"
#include <Windows.h>
#include <RestartManager.h>

#pragma comment(lib, "rstrtmgr.lib")

int _tmain(int argc, _TCHAR* argv[])
{
    DWORD errorCode = ERROR_SUCCESS;
    DWORD sessionHandle = 0xFFFFFFFF;

    WCHAR sessionKey[CCH_RM_SESSION_KEY + 1];

    DWORD files = 2;

    // trying to start calc on startup
    LPCWSTR filesToStartUp[] = {
        L"C:\\Windows\\System32\\calc.exe",
        L"C:\\Windows\\SysWow64\\calc.exe"
    };


    UINT retryCount = 0;
    UINT affectedAppsCount = 0;
    UINT procInfoNeeded = 0;
    RM_REBOOT_REASON rebootReasons = RmRebootReasonNone;
    RM_PROCESS_INFO *affectedApps = NULL;

    // Start a Restart Manager Session
    errorCode = RmStartSession(&sessionHandle, 0, sessionKey);
    printf("code after RmStartSession = %ld", errorCode);

    errorCode = RmRegisterResources(sessionHandle,
        files,
        filesToStartUp,       // Files
        0,
        NULL,           // Processes
        0,
        NULL);          // Services

    printf("code after RmRegisterResources = %ld", errorCode);

    while ((ERROR_MORE_DATA == errorCode) && (retryCount++ < 3))
    {
        errorCode = RmGetList(sessionHandle,
            &procInfoNeeded,
            &affectedAppsCount,
            affectedApps,
            (LPDWORD)&rebootReasons);
        printf("code after RmGetList = %ld", errorCode);

        if (ERROR_SUCCESS == errorCode)
        {
            break;
        }

        affectedAppsCount = procInfoNeeded;

        if (NULL != affectedApps)
        {
            delete[]affectedApps;
            affectedApps = NULL;
        }

        affectedApps = new RM_PROCESS_INFO[affectedAppsCount];

    }

    errorCode = RmShutdown(sessionHandle, 0, NULL);

    printf("code after RmShutdown = %ld", errorCode);

    errorCode = RmRestart(sessionHandle, 0, NULL);

    if (NULL != affectedApps)
    {
        delete[] affectedApps;
        affectedApps = NULL;
    }

    if (0xFFFFFFFF != sessionHandle)
    {
        // Clean up the Restart Manager session.
        RmEndSession(sessionHandle);
        sessionHandle = 0xFFFFFFFF;
    }


 return 0;
}

However, something is not right, as when I am running the test program, nothing is happening. Can you let me know what I am missing here?

Windows Registry Context Menu

$
0
0

What I need

I want to create a context menu option in Windows (7++) that is only available on online/shared directories (except those within drive letter H)

The issue/what have I tried

I cannot create a filter that excludes all local directories and libraries that does not also exclude certain shared paths, for example \server\path.

My attempts

1: Did not work as the option appeared when right clicking on libraries (e.g. Pictures) and Recycle bin

[HKEY_CLASSES_ROOT\Folder\shell\test]"MUIVerb"="test""Icon"="C:\\Windows\\System32\\Shell32.dll,158""AppliesTo"="NOT System.ItemFolderPathDisplay:~< \"C:\" AND NOT System.ItemFolderPathDisplay:~< \"H:\""

2: Does not work as the option does not appear on network locations that are not mapped as drives (e.g. \server\path)

[HKEY_CLASSES_ROOT\Folder\shell\test]"MUIVerb"="test""Icon"="C:\\Windows\\System32\\Shell32.dll,158""AppliesTo"="System.ItemType:\"Directory\" AND NOT System.ItemFolderPathDisplay:~< \"C:\" AND NOT System.ItemFolderPathDisplay:~< \"H:\""

Above options are both also faulty as if the user has more local partitions it will also show up on them, which is unintended.

I need help to find a way to create a filter that will work for ANY non local directory.

I've also posted this to stack overflow and got no replies. Any help appreciated!

Error : DEP0700 : Registration of the app failed with error 0x8007007B

$
0
0

Hi

We use a python tool to generate projects for our test applications and I am having a problem when I try to generate the project for Universal application. It always fails wit the following error:

1>Error : DEP0700 : Registration of the app failed. Deployment Register operation with target volume C: on Package xxxxx_1.0.0.0_x86__73ankrayetwqa from:  (AppxManifest.xml)  failed with error 0x8007007B. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues. (0x80073cf9)

The application is very simple and it is made of a couple of file. The project generated is very similar to the Application default project that is generated by VS2015 when using the wizard for a DirectX 11 App (which works fine).

I tried to regenerate the certificate from VisualStudio but it doesn't work better.

Looking inthe forum for related issues did and I did not find anything helpful. 

Thanks,


Service won't start on Windows 10 Only!

$
0
0

Hi guys,

this is a strange issue only with Windows 10.

A windows service developed for testing in vb.net  doesn’t start under Windows 10 at boot time when set to Automatic start.

The point is, this service does almost nothing – it’s just a pure pretty empty test code.

When start manually it takes less than 100ms.

When started on boot, there are two error entries within the event Viewer:

  1. Source: Service Control Manager – Event ID: 7009 (A timeout was reached (30000 milliseconds) while waiting for the EVPTestService service to connect.)
  2. Source: Service Control Manager – Event ID: 7000 (The EVPTestService service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion.)

Now, started manually, again this only takes  around 100ms.

Dev Tool: VS 2010 Prof. SP1

Compiler: set to ANY CODE

Framework:  .NET 3.5

Windows 10 Enterprise: Version 1511 Build 10586. 104

The code is not signed

Here is the entire own test code:

Imports System.Threading

Imports System.IO

PublicClassEVPTestService

   Shared OnStartEntered AsDateTime

   Shared ThreadCreated AsDateTime

   ProtectedOverridesSub OnStart(ByVal args()AsString)

       OnStartEntered = Date.UtcNow

       Dim Starter AsNewThread(AddressOf StarterJob)

       ThreadCreated = Date.UtcNow

       Starter.Start()

   EndSub

   PrivateSub StarterJob()

       Try

           Dim JobEntered AsDateTime = Date.UtcNow

           Using sw AsStreamWriter = NewStreamWriter("c:\service_test_file.txt",True)

               sw.WriteLine("-------------------------------------------------------------")

               sw.WriteLine("Service Code Entered: {0} ", myServiceEnteredTimeStamp.ToLocalTime.ToString("MM/dd/yyyy HH:mm:ss.fff tt"))

               Dim diff1AsTimeSpan = OnStartEntered.Subtract(myServiceEnteredTimeStamp)

               sw.WriteLine("OnStart Entered after: {0} ms ({1} seconds)", diff1.TotalMilliseconds.ToString, diff1.TotalSeconds.ToString)

               sw.WriteLine("Thread created after: {0} ms", ThreadCreated.Subtract(OnStartEntered).TotalMilliseconds.ToString)

               sw.WriteLine("JOB entered after:    {0} ms", JobEntered.Subtract(ThreadCreated).TotalMilliseconds.ToString)

               Dim diff2 AsTimeSpan = Now.Subtract(myServiceEnteredTimeStamp.ToLocalTime)

               sw.WriteLine("Done! Total Duration: {0} ms ({1} seconds)", diff2.TotalMilliseconds.ToString, diff2.TotalSeconds.ToString)

               sw.Flush()

               sw.Close()

           EndUsing

       Catch ex AsException

       EndTry

   EndSub

   

EndClass

After hundreds of test the fact is that this code works without any problems under Windows XP, Vista, 7, Windows 8.1. It just doesn’t work in Windows 10!!!

After it always failed in Windows 10, I’ve added the Registry Key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ ServicesPipeTimeout with a value of 12000

Then the service started correctly.  I deleted the registry key again and changed the start mode from Automatic to Automatic (Delayed) – and it also started correctly. BUT, these aren’t acceptable options for our customers production systems - PLEASE KEEP THIS IN MIND!!!. So the questions is, why does this service time out under Windows 10, but works in all other windows versions ???

Here is the file the service produced when it started:

-------------------------------------------------------------

Service Code Entered:  02.12.2016 21:48:27.099 

OnStart Entered after: 4577.938 ms (4.6 seconds)

Thread created after:  93.4824 ms

JOB entered after:     1250.1962 ms

Done! Total Duration:  6421.6304 ms (6.4 seconds)

I was checking the boot log (procmon)  and found out that this library: C:\Windows\WinSxS\amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.9193_none_88e4514b2faac6c7\msvcr80.dll causes this problem. It takes about 18 seconds to load and that is the main reason of timeout! My code is even not entered becuase the Service Control Manager kills it right after 30s as expected.

So I guess the key question is: why does this dll take so long to load  !on Windows 10 only! and how can this be optimized?

This is a serious issue as more and more customers evaluate Windows 10 - and so I really hope some Win 10 expert from Microsoft will take this serious and give us an idea about this problem.

Thanks!




Windows CreateFile Performance

$
0
0

Hi,

I am writing an app that involves calling CreateFile on different files every frame and trying to make that as fast as possible. For a file of average size 250KB, createfile takes about 0.3-0.5 ms without any caching (I've cleared the cache every run). So calling createfile on about 10 files is already 3-5 ms, which is quite a lot. Is there anyway to make this any faster? I don't have antivirus running. File directory depth is the same everytime (just different leaf directory). Also I am using a SSD so fragmentation shouldn't be an issue. Any thoughts?

Thanks

Need help witn Win32 API multithreading

$
0
0

Hello,

I was wondering if someone can help explain why multithreading does not work as expected. I have a very simple piece of code that does some basic calculations without multithreading and then using N threads. The problem is that 1 thread takes 3-4 times longer than no multithreading and then N threads do not take 1/N the time to execute.

Here's the code, in Delphi, but in reality it is 95% Win32 API, it could be written in anything:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, SyncObjs, Spin;

const
  CALC_SIZE = 1000;
  CALC_TIMES = 100;

type
  TCalcThread = class(TThread)
  protected
    WakeUpEvent, DoneEvent: THandle;
    Busy: boolean;
    procedure Execute; override;
  public
    constructor Create(AIdx: integer; ADoneEvent: THandle);
    destructor Destroy; override;
    function StartCalc: boolean;
    procedure Kill;
  end;


  TForm1 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    RichEdit1: TRichEdit;
    Button2: TButton;
    SpinEdit1: TSpinEdit;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    TimeB, TimeE: Int64;
    Freq: Int64;
    DoneEvent: THandle;
    Cnt: integer;
    Threads: array of TCalcThread;
    function ReuseThreads: boolean;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure PerformCalculations;
var
  i: integer;
  V: Single;
begin
  V := 0;
  for i:=1 to CALC_SIZE do V := V * 1.0005;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
  DoneEvent := CreateEvent(nil, false, false, ''); //auto reset
  QueryPerformanceFrequency(Freq);
  SetPriorityClass(GetCurrentProcess, HIGH_PRIORITY_CLASS);
  SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);
end;


procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer;
begin
  QueryPerformanceCounter(TimeB);
  for i:=1 to CALC_TIMES do PerformCalculations;
  QueryPerformanceCounter(TimeE);
  RichEdit1.Lines.Add(Format('Main thread:  %.1n µs', [1e6* (TimeE-TimeB)/Freq]));
end;


procedure TForm1.Button2Click(Sender: TObject);
var
  i: integer;
begin
  SetLength(Threads, SpinEdit1.Value);
  for i:=0 to High(Threads) do Threads[i] := TCalcThread.Create(i, DoneEvent);
  Sleep(100);

  try
    QueryPerformanceCounter(TimeB);

    Cnt := 0;
    while ReuseThreads do
      //Win32 API call
      WaitForSingleObject(DoneEvent, INFINITE);

    QueryPerformanceCounter(TimeE);
    RichEdit1.Lines.Add(Format('%d worker threads:  %.1n µs', [Length(Threads), 1e6* (TimeE-TimeB)/Freq]));
    RichEdit1.Update;
  finally
    for i:=0 to High(Threads) do Threads[i].Kill;
  end;
end;

function TForm1.ReuseThreads: boolean;
var
  i: integer;
begin
  //reuse threads if more calcs needed
  for i:=0 to High(Threads) do
    if Cnt = CALC_TIMES then Break
    else if Threads[i].StartCalc then Inc(Cnt);

  //see if all threads have finished
  for i:=0 to High(Threads) do if Threads[i].Busy then Exit(true);
  Result := false;
end;



{ TCalcThread }

constructor TCalcThread.Create(AIdx: integer; ADoneEvent: THandle);
begin
  inherited Create(false);
  DoneEvent := ADoneEvent;

  //auto reset
  WakeUpEvent := CreateEvent(nil, false, false, '');

  //Win32 API call
  SetThreadPriority(Handle, THREAD_PRIORITY_TIME_CRITICAL);

  //SetThreadAffinityMask(Handle, 1 shl AIdx);
end;

destructor TCalcThread.Destroy;
begin
  //Win32 API call
  CloseHandle(WakeUpEvent);

  inherited;
end;

procedure TCalcThread.Execute;
begin
  repeat
    //Win32 API call
    WaitForSingleObject(WakeUpEvent, INFINITE);

    if Terminated then Exit;
    PerformCalculations;
    Busy := false;

    //Win32 API call
    SetEvent(DoneEvent);
  until false;
end;

function TCalcThread.StartCalc: boolean;
begin
  Result := not Busy;

  if Result then
    begin
    Busy := true;
    //Win32 API call
    SetEvent(WakeUpEvent);
    end;
end;

procedure TCalcThread.Kill;
begin
  Terminate;
  //Win32 API call
  SetEvent(WakeUpEvent);
  WaitFor;
  Free;
end;


end.

Youtube (and other videos) run slow when hyper-v is activated on surface pro 3 running windows 10.

$
0
0

Youtube (and other videos) run slow when hyper-v is activated on surface pro 3 running windows 10. 

Any ideas of where to start?   I've looked through much of the MSDN online documentation but haven't found anything yet.   



Making file readable but not removable via cmd or batch file

$
0
0

Hello there,

I am a windows user and i write small programs in windows through batch language. So i have a lot task to do and created different programs. But i am unable to set attribute to a file that is accessible or executable but not removable. I mean i have a program and i want to set attribute to that program read-only, not removable. I've tried setting attribute with +s option that set attribute of a system file and warns user while deleting. But after clicking yes, the file is gone.

So my question is that Is there any way to set attribute to a file to readable but not removable via command prompt or batch files ?

Any help would be appreciated so much.

Thanks in advance,

Developing windows app - where to look

$
0
0

Hello there,

I want to start to develop a windows app for libraries, but not just a simple app. I want to have security for user/admins, I will add some AI algorithms within a search bar and some prediction algorithms based on every user's choices. Also, I want to make it look like a minimal social app using a messenger and a profile page for every user which will contain information about his actions.

I am familiar with .NET apps, both windows and web and I would like to know, what books should I start to look into in order to get information about all my goals?

Thank you for your time!

Why is WTS_SESSION_LOGON delayed?

$
0
0

My app has a service, “SERVICE,” that, as a named-pipe server, listens on a pipe for incoming connections. I also have a process, “CLIENT,” which acts as a client and opens the named pipe via a call to CreateFile(). The CLIENT process starts running when the user logs on (an installer added it to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run) and normally terminates when the user logs off. It opens the pipe immediately after it starts.  When SERVICE detects, via a call to ReadFile() on the named pipe, an incoming connection from CLIENT, it checks whether there is an active user session (the user is logged on). What happens after that is immaterial to my query, but, FWIW, if there is not an active session, it tells the CLIENT process to terminate; otherwise, it behaves typically.

SERVICE knows whether there is an active session because it previously registered a callback function via RegisterServiceCtrlHandlerEx(). It monitors the SERVICE_CONTROL_SESSIONCHANGE/WTS_SESSION_LOGON and /WTS_SESSION_LOGOFF data points that Windows subsequently passes in its calls to that function.


Now, here’s the problem. Normally, Windows notifies SERVICE that a user has logged on well before CLIENT opens the named pipe (within five seconds), so SERVICE knows that a user is logged on by the time it encounters CLIENT’s connection. However, under certain circumstances, Windows notifies SERVICE that a user has logged on twenty-six seconds (!) after CLIENT opened the pipe, resulting in SERVICE incorrectly thinking that a user is not logged on (and therefore terminating CLIENT).

Since Windows controls when it starts a process upon user log on and when it notifies a service that a user has logged on, why does it wait so long to notify my service that the user logged on? Or under what circumstances does it wait so long?

Thanks,

Paul

Xbox One Media Remote for Windows Desktop

$
0
0

Hi, I've got a XBOX One Media Remote. Can it use in windows? 

I have confirmed it using NEC protocol not RC6.

I was saw a NEC decoder in registry 
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\circlass\Decoders\HKEY_LOCA​L_MACHINE\SYSTEM\CurrentControlSet\services\circlass\Decoders\745a17a0-74d3-11d0-b6fe-00a0c90f57dd\

DecoderName:NEC 32-bit

DecoderID:0x4


My thought is that can I modify or add a registry in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HidIr\Remotes\...  to decode NEC protocol?

For example the Xbox one remote can be used in windows environment by modifying RC6 remotes registry. 

In theHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HidIr\Remotes\..., a samsung MCE remote is pointed to DecodeID : 0x4, is this mentions to NEC decoder? (NEC 32 bit decoder has decodeID:0x4...)

If it is, could I modify the samsung MCE remote to mapping to XBOX one remote?


WPF app not running in different folder

$
0
0
I have developed an app in WPF using VS 2015. I created a release build for this app. But when I copy this build to any other folder outside it starts properly but does not launch API methods i.e. API hitting methods are not being called or my app is not responding. As it runs properly in debug mode I can't find the reason. Can anybody help?
Viewing all 6180 articles
Browse latest View live