# SerialDisplayAdvancedSettings

### C# Signature:

```cs
[DllImport("msports.dll", SetLastError=true)]
static extern int SerialDisplayAdvancedSettings(IntPtr parentHwnd, IntPtr deviceInfoSet, ref SP_DEVINFO_DATA deviceInfoData);
```

### VB Signature:

```cs
Declare Function SerialDisplayAdvancedSettings Lib "msports.dll" (TODO) As TODO
```

### Sample Code:

```cs
var deviceClassGuid = Guid.Parse("{4d36e978-e325-11ce-bfc1-08002be10318}"); // Ports class GUID
const int DIGCF_PRESENT = 0x2;
IntPtr deviceInfoSetHandle = NativeMethods.SetupDiGetClassDevs(ref deviceClassGuid, null, IntPtr.Zero, DIGCF_PRESENT);

try
{
    // search frendlyName and open advanced settings
    var deviceInfoData = new SP_DEVINFO_DATA();
    deviceInfoData.CbSize = (uint)Marshal.SizeOf(deviceInfoData);

    uint index = 0;
    while (NativeMethods.SetupDiEnumDeviceInfo(deviceInfoSetHandle, index++, ref deviceInfoData))
    {
        var buffer = new byte[300];
        const uint SPDRP_FRIENDLYNAME = 0xC;
        NativeMethods.SetupDiGetDeviceRegistryProperty(deviceInfoSetHandle, ref deviceInfoData, SPDRP_FRIENDLYNAME, out var _, buffer, (uint)buffer.Length, out var _);

        var friendlyName = Encoding.Unicode.GetString(buffer).TrimEnd('\0');
        if (friendlyName == "...")
        {
            NativeMethods.SerialDisplayAdvancedSettings(IntPtr.Zero, deviceInfoSetHandle, ref deviceInfoData);
            return;
        }
    }
}
finally
{
    NativeMethods.SetupDiDestroyDeviceInfoList(deviceInfoSetHandle);
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pinvokeisalive.gitbook.io/pinvoke/desktopfunctions/msports/serialdisplayadvancedsettings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
