convertToCLSID function Null safety com

Pointer<GUID> convertToCLSID(
  1. String strCLSID

Converts a Dart string into an CLSID using the CLSIDFromString call.

Returns a Pointer to the allocated CLSID. It is the caller's responsibility to deallocate the pointer when they are finished with it.


Pointer<GUID> convertToCLSID(String strCLSID) {
  final lpszCLSID = strCLSID.toNativeUtf16();
  final clsid = calloc<GUID>();

  try {
    final hr = CLSIDFromString(lpszCLSID, clsid);
    if (FAILED(hr)) {
      throw WindowsException(hr);
    return clsid;
  } finally {