#include "../librpc/gen_ndr/ndr_svcctl_c.h"
struct svc_state_msg {
- uint32 flag;
+ uint32_t flag;
const char *message;
};
/********************************************************************
********************************************************************/
-const char *svc_status_string( uint32 state )
+const char *svc_status_string( uint32_t state )
{
fstring msg;
int i;
TALLOC_CTX *mem_ctx,
struct policy_handle *hSCM,
const char *service,
- uint32 *state )
+ uint32_t *state )
{
struct policy_handle hService;
struct SERVICE_STATUS service_status;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
NTSTATUS status;
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
TALLOC_CTX *mem_ctx,
struct policy_handle *hSCM,
const char *service,
- uint32 watch_state,
- uint32 *final_state )
+ uint32_t watch_state,
+ uint32_t *final_state )
{
- uint32 i;
- uint32 state = 0;
- WERROR result = WERR_GENERAL_FAILURE;
+ uint32_t i;
+ uint32_t state = 0;
+ WERROR result = WERR_GEN_FAILURE;
i = 0;
TALLOC_CTX *mem_ctx,
struct policy_handle *hSCM,
const char *service,
- uint32 control,
- uint32 watch_state )
+ uint32_t control,
+ uint32_t watch_state )
{
struct policy_handle hService;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
NTSTATUS status;
struct SERVICE_STATUS service_status;
- uint32 state = 0;
+ uint32_t state = 0;
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
/* Open the Service */
{
struct policy_handle hSCM;
struct ENUM_SERVICE_STATUSW *services = NULL;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
NTSTATUS status;
int i;
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
- uint8_t *buffer = NULL;
+ uint8_t *buffer;
uint32_t buf_size = 0;
uint32_t bytes_needed = 0;
uint32_t num_services = 0;
return werror_to_ntstatus(result);
}
+ buffer = talloc_array(mem_ctx, uint8_t, buf_size);
+ if (buffer == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
do {
status = dcerpc_svcctl_EnumServicesStatusW(b, mem_ctx,
&hSCM,
}
if (W_ERROR_EQUAL(result, WERR_MORE_DATA) && bytes_needed > 0) {
- buffer = talloc_array(mem_ctx, uint8_t, bytes_needed);
buf_size = bytes_needed;
+ buffer = talloc_realloc(mem_ctx, buffer, uint8_t, bytes_needed);
+ if (buffer == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ break;
+ }
continue;
}
} while (W_ERROR_EQUAL(result, WERR_MORE_DATA));
+done:
if (is_valid_policy_hnd(&hSCM)) {
WERROR _result;
dcerpc_svcctl_CloseServiceHandle(b, mem_ctx, &hSCM, &_result);
const char **argv )
{
struct policy_handle hSCM, hService;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
NTSTATUS status;
struct SERVICE_STATUS service_status;
struct QUERY_SERVICE_CONFIG config;
const char **argv )
{
struct policy_handle hSCM;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
if (argc != 1 ) {
const char **argv )
{
struct policy_handle hSCM;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
if (argc != 1 ) {
const char **argv )
{
struct policy_handle hSCM;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
if (argc != 1 ) {
const char **argv )
{
struct policy_handle hSCM, hService;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
NTSTATUS status;
- uint32 state = 0;
+ uint32_t state = 0;
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
if (argc != 1 ) {
const char **argv)
{
struct policy_handle hSCM, hService;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
NTSTATUS status;
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
const char **argv)
{
struct policy_handle hSCM, hService;
- WERROR result = WERR_GENERAL_FAILURE;
+ WERROR result = WERR_GEN_FAILURE;
NTSTATUS status;
const char *ServiceName;
const char *DisplayName;