WindowsProgramTypeForGUID resolves a GUID to a ProgramType. The GUID must be in the form of "{XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}". Returns an error wrapping [os.ErrNotExist] if the GUID is not recignized.
(guid string)
| 16 | // |
| 17 | // Returns an error wrapping [os.ErrNotExist] if the GUID is not recignized. |
| 18 | func WindowsProgramTypeForGUID(guid string) (ProgramType, error) { |
| 19 | progTypeGUID, err := windows.GUIDFromString(guid) |
| 20 | if err != nil { |
| 21 | return 0, fmt.Errorf("parse GUID: %w", err) |
| 22 | } |
| 23 | |
| 24 | rawProgramType, err := efw.EbpfGetBpfProgramType(progTypeGUID) |
| 25 | if err != nil { |
| 26 | return 0, fmt.Errorf("get program type: %w", err) |
| 27 | } |
| 28 | |
| 29 | if rawProgramType == 0 { |
| 30 | return 0, fmt.Errorf("program type not found for GUID %v: %w", guid, os.ErrNotExist) |
| 31 | } |
| 32 | |
| 33 | return ProgramTypeForPlatform(platform.Windows, rawProgramType) |
| 34 | } |
| 35 | |
| 36 | // WindowsAttachTypeForGUID resolves a GUID to an AttachType. |
| 37 | // |
searching dependent graphs…