> For the complete documentation index, see [llms.txt](https://www.pinvoke.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pinvoke.dev/advapi32/createservicea.md).

# CreateServiceA

```csharp
[DllImport("ADVAPI32.dll", ExactSpelling = true, SetLastError = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
public static extern unsafe SC_HANDLE CreateServiceA(
    SC_HANDLE hSCManager,
    PCSTR lpServiceName,
    PCSTR lpDisplayName,
    uint dwDesiredAccess,
    ENUM_SERVICE_TYPE dwServiceType,
    SERVICE_START_TYPE dwStartType,
    SERVICE_ERROR dwErrorControl,
    PCSTR lpBinaryPathName,
    PCSTR lpLoadOrderGroup,
    [Optional] uint* lpdwTagId,
    PCSTR lpDependencies,
    PCSTR lpServiceStartName,
    PCSTR lpPassword);
```

[ENUM\_SERVICE\_TYPE](/services/enum_service_type.md)

[SERVICE\_START\_TYPE](/services/service_start_type.md)

[SERVICE\_ERROR](/services/service_error.md)
