Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion InfHelper/src/Parsers/ContentParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ protected void InitPureValueParsing()
new ValueMarkerToken(),
new SpaceToken(),
new WhiteSpaceToken(),
new ValueSeparatorToken()
new ValueSeparatorToken(),
new NewLineToken()
};

parser.IgnoredTokens = new HashSet<TokenBase>()
Expand Down Expand Up @@ -206,6 +207,7 @@ private void ValidTokenFoundDuringPureValueParsing(object sender, TokenBase toke
keyTmpValue += tokenBase.Symbol;
break;
case TokenType.ValueMarker:
case TokenType.NewLine:
ValueParsingComplete(true);
InitKeyValueParsing();
break;
Expand Down
3 changes: 3 additions & 0 deletions InfHelperTests/InfHelperTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
</Content>
<Content Include="infs\oem136.inf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="infs\oem137.inf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="infs\oem144.inf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
220 changes: 220 additions & 0 deletions InfHelperTests/infs/oem137.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
;; Copyright (c) 2013 Razer Inc.
;;
;; INF file to install Kraken USB custom sAPO over HD Audio / USB Audio devices
;; 32/64 bits

[Version]
Signature="$Windows NT$"
Class=MEDIA
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
provider=%ProviderName%
CatalogFile=Kraken0502.cat
DriverVer=05/23/2014,15.58.25.206

[SourceDisksNames]
222=%DiskDescription%,,,\

[SourceDisksFiles]
Kraken0502lfx.dll=222


[DestinationDirs]
DefaultDestDir=11 ; %windir%\system32
SfxFx.CopyList=11 ; %windir%\system32

[SignatureAttributes]
Kraken0502lfx.dll=SignatureAttributes.PETrust
Kraken0502lfx.dll=SignatureAttributes.DRM

[SignatureAttributes.DRM]
DRMLevel=1300
[SignatureAttributes.PETrust]
PETrust=true

[Manufacturer]
%MfgName%=avolute.section, ntamd64

;; Excluding drivers from the "Add New Hardware" list. Uncomment this when shipping your product.
[ControlFlags]
ExcludeFromSelect = *

[avolute.section]
%USB\Razer_Kraken.DeviceDesc% = USBAudio.SysFx,USB\VID_1532&PID_0502&MI_00

[avolute.section.NTamd64]
%USB\Razer_Kraken.DeviceDesc% = USBAudio.SysFx,USB\VID_1532&PID_0502&MI_00

;;
;; Include/Need sections from OS installed inf file
;;
[USBAudio.SysFx]
Include=ks.inf,wdmaudio.inf,wdma_usb.inf
Needs=KS.Registration, WDMAUDIO.Registration, USBAudioOEM.CopyFiles, USBAudioOEM.AddReg, USBMic
CopyFiles=SfxFx.CopyList
AddProperty=OEMCustomBranding.AddProperty
RegisterDlls=SfxFx.RegisterDlls
AddReg=NahimicSettings.AddReg


[OEMCustomBranding.AddProperty]

;; OEM branding Icon resource location
;DeviceBrandingIcon,,,,"%1%\Krakenproppage.dll,-200"

;; OEM vendor Website URL
DeviceVendorWebSite,,,,"http://www.razerzone.com"


;;
;; Interfaces sections
;;
[USBAudio.SysFx.Interfaces]

;; -------------------------------------------------------------------------------------------
;; Render Interfaces

AddInterface=%KSCATEGORY_CAPTURE%,%KSNAME_Global%,USBAudio.SysFx.wave
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Global%,USBAudio.SysFx.wave
AddInterface=%KSCATEGORY_RENDER%,%KSNAME_Global%,USBAudio.SysFx.wave


; --------
; RENDER
[USBAudio.SysFx.wave]
AddReg=SysFx.AddReg

;; --------------------------------------------------------------------------------------------------------
;; SYSFX REG
;; --------------------------------------------------------------------------------------------------------
;;
;; All FX\\0 entries in the same grouping
;;
[SysFx.AddReg]

; Any endpoint
HKR,"FX\\0",%PKEY_ItemNameDisplay%,,%SYSFX_FriendlyName%
HKR,"FX\\0",%PKEY_SYSFX_PreMixClsid%,,%SYSFX_PREMIX_CLSID%
HKR,"FX\\0",%PKEY_SYSFX_PostMixClsid%,,%SYSFX_POSTMIX_CLSID%
HKR,"FX\\0",%PKEY_SYSFX_UiClsid%,,%SYSFX_UI_CLSID%
HKR,"FX\\0",%PKEY_AudioEndpoint_Disable_SysFx%, %REG_DWORD%, 0x0000 ; Enable SysFX
HKR,"FX\\0",%PKEY_SYSFX_Association%,,%KSNODETYPE_HEADPHONES%

; Any endpoint
HKR,"FX\\1",%PKEY_ItemNameDisplay%,,%SYSFX_FriendlyName%
HKR,"FX\\1",%PKEY_SYSFX_PreMixClsid%,,%SYSFX_PREMIX_CLSID%
HKR,"FX\\1",%PKEY_SYSFX_PostMixClsid%,,%SYSFX_POSTMIX_CLSID%
HKR,"FX\\1",%PKEY_SYSFX_UiClsid%,,%SYSFX_UI_CLSID%
HKR,"FX\\1",%PKEY_AudioEndpoint_Disable_SysFx%, %REG_DWORD%, 0x0000 ; Enable SysFX
HKR,"FX\\1",%PKEY_SYSFX_Association%,,%KSNODETYPE_MICROPHONE%

;; --------------------------------------------------------------------------------------------------------
;; Service Section
;; --------------------------------------------------------------------------------------------------------

[USBAudio.SysFx.Services]
Include=wdma_usb.inf
Needs=USBAudio.Services

;; --------------------------------------------------------------------------------------------------------
;; Copy & Register DLL
;; --------------------------------------------------------------------------------------------------------

;; Copy custom SYSFX and property page

[SfxFx.CopyList]
Kraken0502lfx.dll
;Krakenproppage.dll

;[NSettings.CopyList]
;KrakenSettingsStreamROT.dll

;; Register custom SYSFX and property page

[SfxFx.RegisterDlls]
;11,,Krakenproppage.dll,1
11,,Kraken0502lfx.dll,1
;11,NahimicSettings,KrakenSettingsStreamROT.dll,1

;; --------------------------------------------------------------------------------------------------------
;; Registry key Section
;; --------------------------------------------------------------------------------------------------------

[NahimicSettings.AddReg]
HKLM,SOFTWARE\Razer\Kraken0502_1.0.6\NahimicSettings

[NahimicSettings.AddReg.Security]
"G:BUD:(A;CIOI;KA;;;BU)"

;;
;; The audio engine does not normally load an unsigned sAPO. However,
;; signing is not done until the development process is complete and the driver
;; has been submitted to WHQL. For development and test purposes, the signing
;; requirement can be bypassed by setting the DisableProtectedAudioDG registry
;; value to 1
;;
;[DisableProtectedAudioDG.AddReg]
;HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Audio,DisableProtectedAudioDG,0x00010001,1

;; --------------------------------------------------------------------------------------------------------
;; INF Strings Section
;; --------------------------------------------------------------------------------------------------------

[Strings]
ProviderName="Razer Inc."
MfgName="Razer Inc."
DiskDescription="Zip file"
USB\Razer_Kraken.DeviceDesc="Razer Kraken USB"



; ------------------------------------------------------------------------------------------------------
; These are the strings passed to PcRegisterSubdevice for wave ports

; Output
KSNAME_Global="Global"

;;
;; PropertyKey GUIDS
;;
PKEY_SYSFX_Association = "{D04E05A6-594B-4FB6-A80D-01AF5EED7D1D},0"
PKEY_SYSFX_PreMixClsid = "{D04E05A6-594B-4FB6-A80D-01AF5EED7D1D},1"
PKEY_SYSFX_PostMixClsid = "{D04E05A6-594B-4FB6-A80D-01AF5EED7D1D},2"
PKEY_SYSFX_UiClsid = "{D04E05A6-594B-4FB6-A80D-01AF5EED7D1D},3"
PKEY_ItemNameDisplay = "{B725F130-47EF-101A-A5F1-02608C9EEBAC},10"
PKEY_AudioEndpoint_Config = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},0"
PKEY_AudioEndpoint_Ext_UiClsid = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},1"
PKEY_AudioEndpoint_Association = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},2"
PKEY_AudioEndpoint_Disable_SysFx = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},5"



;;
;; PKEY_AudioEngine_OEMFormat: Specifies the default format that is used for rendering/capturing.
;; vartype = VT_BLOB
;;
PKEY_AudioEngine_OEMFormat = "{E4870E26-3CC5-4CD2-BA46-CA0A9A70ED04},3"

SYSFX_UI_CLSID = "{00000000-0000-0000-0000-000000000000}" ;; GUID of PropPage (Class)
SYSFX_PREMIX_CLSID = "{6162eaa1-be3a-11e3-b1b6-0800200c9a66}" ;; GUID of APO LFX
SYSFX_POSTMIX_CLSID = "{06687E71-F043-403A-BF49-CB591BA6E103}"
SYSFX_FriendlyName = "Kraken USB APO"

KSCATEGORY_AUDIO = "{6994AD04-93EF-11D0-A3CC-00A0C9223196}"
KSCATEGORY_RENDER = "{65E8773E-8F56-11D0-A3B9-00A0C9223196}"
KSCATEGORY_CAPTURE = "{65E8773D-8F56-11D0-A3B9-00A0C9223196}"
KSCATEGORY_TOPOLOGY = "{DDA54A40-1E4C-11D1-A050-405705C10000}"

KSNODETYPE_ANY = "{00000000-0000-0000-0000-000000000000}"
KSNODETYPE_LINE_CONNECTOR = "{DFF21FE3-F70F-11D0-B917-00A0C9223196}"
KSNODETYPE_HEADSET_SPEAKERS = "{DFF21CE6-F70F-11D0-B917-00A0C9223196}"
KSNODETYPE_SPEAKER = "{DFF21CE1-F70F-11D0-B917-00A0C9223196}"
KSNODETYPE_HEADPHONES = "{DFF21CE2-F70F-11D0-B917-00A0C9223196}"
KSNODETYPE_DESKTOP_SPEAKER = "{DFF21CE4-F70F-11D0-B917-00A0C9223196}"
KSNODETYPE_MICROPHONE = "{DFF21BE1-F70F-11D0-B917-00A0C9223196}

;; (cf http://msdn.microsoft.com/en-us/library/dd388914(VS.85).aspx)
Proxy.CLSID = "{17CCA71B-ECD7-11D0-B908-00A0C9223196}"

REG_BINARY = 0x00000001
REG_DWORD = 0x00010001

13 changes: 13 additions & 0 deletions InfHelperTests/src/InfHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@ public void CanParseSpacesInCategoryName()
Assert.IsTrue(info.Categories.Count(x => x.Name == "OEM URLS") == 1);
}

[TestMethod()]
public void AssumeNewLinesEndQuote()
{
var helper = new InfUtil();
var data = helper.ParseFile(Path.Combine(testFolder, "oem137.inf"));

var strings = data.Categories.FirstOrDefault(c => c.Name == "Strings");

Assert.AreEqual("\"{DFF21BE1-F70F-11D0-B917-00A0C9223196}\"", strings.Keys.Where(k => k.Id == "KSNODETYPE_MICROPHONE").First().PrimitiveValue);

Assert.AreEqual("\"{17CCA71B-ECD7-11D0-B908-00A0C9223196}\"", strings.Keys.Where(k => k.Id == "Proxy.CLSID").First().PrimitiveValue);
}

[TestMethod()]
public void EmptySeparatorsAreNull()
{
Expand Down