@@ -413,10 +413,10 @@ INT_PTR CALLBACK PhpServiceGeneralDlgProc(
413
413
ULONG newServiceType ;
414
414
ULONG newServiceStartType ;
415
415
ULONG newServiceErrorControl ;
416
- PPH_STRING newServiceGroup ;
417
- PPH_STRING newServiceBinaryPath ;
418
- PPH_STRING newServiceUserAccount ;
419
- PPH_STRING newServicePassword ;
416
+ PPH_STRING newServiceGroup = NULL ;
417
+ PPH_STRING newServiceBinaryPath = NULL ;
418
+ PPH_STRING newServiceUserAccount = NULL ;
419
+ PPH_STRING newServicePassword = NULL ;
420
420
421
421
SetWindowLongPtr (hwndDlg , DWLP_MSGRESULT , PSNRET_NOERROR );
422
422
@@ -432,23 +432,15 @@ INT_PTR CALLBACK PhpServiceGeneralDlgProc(
432
432
newServiceStartType = PhGetServiceStartTypeInteger (newServiceStartTypeString -> Buffer );
433
433
newServiceErrorControl = PhGetServiceErrorControlInteger (newServiceErrorControlString -> Buffer );
434
434
435
- newServiceGroup = PH_AUTO (PhGetWindowText (GetDlgItem (hwndDlg , IDC_GROUP )));
436
- newServiceBinaryPath = PH_AUTO (PhGetWindowText (GetDlgItem (hwndDlg , IDC_BINARYPATH )));
437
- newServiceUserAccount = PH_AUTO (PhGetWindowText (GetDlgItem (hwndDlg , IDC_USERACCOUNT )));
438
-
435
+ if (GetWindowTextLength (GetDlgItem (hwndDlg , IDC_GROUP )))
436
+ newServiceGroup = PH_AUTO (PhGetWindowText (GetDlgItem (hwndDlg , IDC_GROUP )));
437
+ if (GetWindowTextLength (GetDlgItem (hwndDlg , IDC_BINARYPATH )))
438
+ newServiceBinaryPath = PH_AUTO (PhGetWindowText (GetDlgItem (hwndDlg , IDC_BINARYPATH )));
439
+ if (GetWindowTextLength (GetDlgItem (hwndDlg , IDC_USERACCOUNT )))
440
+ newServiceUserAccount = PH_AUTO (PhGetWindowText (GetDlgItem (hwndDlg , IDC_USERACCOUNT )));
441
+
439
442
if (Button_GetCheck (GetDlgItem (hwndDlg , IDC_PASSWORDCHECK )) == BST_CHECKED )
440
- {
441
443
newServicePassword = PhGetWindowText (GetDlgItem (hwndDlg , IDC_PASSWORD ));
442
- }
443
- else
444
- {
445
- newServicePassword = NULL ;
446
- }
447
-
448
- if (newServiceType == SERVICE_KERNEL_DRIVER && newServiceUserAccount -> Length == 0 )
449
- {
450
- newServiceUserAccount = NULL ;
451
- }
452
444
453
445
serviceHandle = PhOpenService (serviceItem -> Name -> Buffer , SERVICE_CHANGE_CONFIG );
454
446
@@ -459,8 +451,8 @@ INT_PTR CALLBACK PhpServiceGeneralDlgProc(
459
451
newServiceType ,
460
452
newServiceStartType ,
461
453
newServiceErrorControl ,
462
- newServiceBinaryPath -> Buffer ,
463
- newServiceGroup -> Buffer ,
454
+ PhGetString ( newServiceBinaryPath ) ,
455
+ PhGetString ( newServiceGroup ) ,
464
456
NULL ,
465
457
NULL ,
466
458
PhGetString (newServiceUserAccount ),
@@ -502,8 +494,8 @@ INT_PTR CALLBACK PhpServiceGeneralDlgProc(
502
494
newServiceType ,
503
495
newServiceStartType ,
504
496
newServiceErrorControl ,
505
- newServiceBinaryPath -> Buffer ,
506
- newServiceGroup -> Buffer ,
497
+ PhGetString ( newServiceBinaryPath ) ,
498
+ PhGetString ( newServiceGroup ) ,
507
499
NULL ,
508
500
NULL ,
509
501
PhGetString (newServiceUserAccount ),
0 commit comments