Následující úryvek kódu vypíše seznam systémových služeb.

#include <windows.h>
#include <stdio.h>
 
int main(int argc, char *argv[]){
  SC_HANDLE scHandle = OpenSCManagerA(NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE);
  DWORD dwBytesNeeded = 0, dwNumOfRets = 0, dwResHandle = 0;
  ENUM_SERVICE_STATUSA *ess, *ess_copie;
 
  if(scHandle == NULL){
    printf("Error: OpenSCManager\n");
    return 1;
  }
 
  EnumServicesStatusA(scHandle, SERVICE_DRIVER | SERVICE_WIN32, 
                      SERVICE_STATE_ALL, NULL, 0, 
                      &dwBytesNeeded, &dwNumOfRets, &dwResHandle);
 
 
  ess = (ENUM_SERVICE_STATUSA *) malloc((dwBytesNeeded + sizeof(ENUM_SERVICE_STATUSA)) * 
                                        sizeof(ENUM_SERVICE_STATUSA));
 
  if(!EnumServicesStatusA(scHandle, SERVICE_DRIVER | SERVICE_WIN32, 
                          SERVICE_STATE_ALL, ess, dwBytesNeeded, 
                          &dwBytesNeeded, &dwNumOfRets, &dwResHandle)){
    printf("Error: EnumServicesStatus\n");
    CloseServiceHandle(scHandle);
    free(ess);
    return 2;
  }
 
  ess_copie = ess;
 
  while(dwNumOfRets > 0){
    printf("%s\n%s\n", ess->lpDisplayName, ess->lpServiceName);
    printf("-----------------------------------------------------\n");
    ess++;
    dwNumOfRets--;
  }
 
  CloseServiceHandle(scHandle);
  free(ess_copie);
 
  printf("Press enter...");
  getchar();
 
  return 0;
}