advapi32/tests: Refactor the retrieval of a security descriptor into a separate funct...