需要添加:
#pragma comment(lib, "advapi32.lib")
https://learn.microsoft.com/zh-cn/windows/win32/services/starting-a-service