$100 bounty for help with Windows Service code

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 17 18:11:35 PDT 2014


On Monday, 18 August 2014 at 00:37:15 UTC, Tyler Jensen wrote:
> On Monday, 18 August 2014 at 00:07:57 UTC, ketmar via 
> Digitalmars-d wrote:
>> On Sun, 17 Aug 2014 23:56:54 +0000
>> Tyler Jensen via Digitalmars-d <digitalmars-d at puremagic.com> 
>> wrote:
>>
>> try to catch and process exceptions where they may arose. any 
>> file
>> operation can throw exception (yes, even innocent-looking 
>> writeln(),
>> let alone 'auto fl = File("...")').
>>
>> also, you don't need to manually close the file, it will be
>> automatically closed when file variable goes out of scope.
>
> Now have all file i/o ops in a try/catch and ignoring errors 
> just to see if that has anything to do with it.

I would recommend wrapping the entire main() function in a 
try/catch block, and logging any caught exceptions.

> The answer is no. I'm still getting result of 0 and a 
> GetLastError return of ERROR_INVALID_HANDLE. Now I just need to 
> figure out why the serviceStatusHandle is invalid. Ideas?

I think I found the problem.

In winsvc.d, SERVICE_STATUS_HANDLE is incorrectly declared as a 
DWORD (4-byte integer), when it should be declared as a HANDLE (8 
bytes on 64-bit platforms).

Please try changing the definition of SERVICE_STATUS_HANDLE from 
DWORD to size_t. I'll commit a fix to the win32 bindings 
repository.


More information about the Digitalmars-d mailing list