Why is my process in a Job if I didn’t put it there?

Hi all, The other day a customer of mine was having this issue on Windows 7: CreateProcessAsUser fails with error 5 (Access Denied) when using Jobs. So he had a Windows service running as System in Session 0, that service created a process running as System in Session 0 too, and this process tried to…

1

CreateProcessAsUser fails with error 5 (Access Denied) when using Jobs

Hi all, The other day I worked on a support case where a Windows service running as System in Session 0 was creating a process also running as System in Session 0, and this new process failed to create another process in the logged-on user’s session (Session 2 in this particular case). And it failed because…

2

How to customize error messages shown when changing password on Windows 7

Hi all, A customer of mine wanted to change the error messages shown to users when changing their password on Windows 7, e.g. when new and old passwords won’t match, or the old password of the user is invalid, etc. On Windows XP they did that with a custom Gina. They wondered if they could…

2

How to create a memory mapped file with C# (Windows Vista / Windows 7)

Hi all,   The following C# sample shows how to create a memory mapped file and use private namespaces to allow access to specific groups of users:   FORM1.CS using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Security.Principal; using System.IO; namespace Alejacma { public…

0

X509Certificate2 raises "The Smart card resource manager is not running" exception

Hi all, Some time ago a customer of mine was getting a CryptographicException with message “The Smart card resource manager is not running” when using X509Certificate2 object in a Windows service. This was the call stack at the point of exception:   at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)    at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer,…

2

SCardEstablishContext fails with SCARD_E_NO_SERVICE error

Hi all, If you call SCardEstablishContext API in a Windows service running under a specific user account (domain\user) or NETWORK SERVICE, you may get the following error on Vista/Server 2008 or Windows 7/Server 2008 R2: 0x8010001d – SCARD_E_NO_SERVICE – “The Smart card resource manager is not running.”. If the service runs as SYSTEM, the same…

3

FileSystemWatcher class does not fire Change events when NotifyFilters.Size is used

Hi all,   A customer of mine was trying to monitor a .log file in a specific folder with .NET’s FileSystemWatcher class and a code like the following:     static void Main(string[] args) { FileSystemWatcher fsw = new FileSystemWatcher(@”C:\mypath”, “myfile.log”); fsw.NotifyFilter = NotifyFilters.Size | NotifyFilters.LastWrite; fsw.Changed += new FileSystemEventHandler(MyChangedMethod); fsw.Error += new ErrorEventHandler(MyErrorMethod); fsw.EnableRaisingEvents =…

1

How to disable "This Web site is attempting to perform a digital certificate operation on your behalf" message

Hi all, A customer of mine was using some web pages to enroll certificates. When using them on Windows 7 and IE8/IE9, they got a popup dialog with a message like the following: —————————Web Access Confirmation—————————This Web site is attempting to perform a digital certificate operation on your behalf: https://myserver/certsrv/certrqma.asp You should only allow known…

0

How to disable the pop up that Windows shows when an app crashes

Hi all, The other day a customer of mine was trying to disable the pop up dialog that Windows shows after an application crashes. On Windows XP, they could get rid of it by going to “Control Panel > System Properties > Advanced > Error reporting”, clicking on “Disable error reporting” and disabling “But notify…

5

EnvelopedCMS throws an "ASN1 out of memory" exception with files larger than 5 MB

Hi all, When using .NET’s EnvelopedCMS to decode a file that is larger than 5 MB, you may get the following exception on Windows 7/Server 2008 R2: Unhandled Exception: System.Security.Cryptography.CryptographicException: ASN1 out of memory.   at System.Security.Cryptography.Pkcs.EnvelopedCms.OpenToDecode(Byte[] encodedMessage)   at System.Security.Cryptography.Pkcs.EnvelopedCms.Decode(Byte[] encodedMessage) This simple code reproduces the issue: byte[] encryptedContent = File.ReadAllBytes(@”c:\EncryptedFile.test”); EnvelopedCms cms = new EnvelopedCms();…

0