advapi32: Test case: refactor the retrieval of a security descriptor into a separate function so that it can be used in other tests.