none
DriverPropertyBagTool.exe bug? RRS feed

  • Question

  • Hello,

    We have encountered problems retrieving values from a compiled V4 driver property bag (compiled using DriverPropertyBagTool.exe). The C# wrapper used by our Printer Extension returns the value "Value does not fall within the expected range" when GetString() is called. A similar error also occurs when the JavaScript constraints retrieves the contents of the same key. After verifying the correctness of the Property Bag XML (schema conformance), I believe this to be a bug of the DriverPropertyBagTool.exe.

    Any help on this?

    Thanks!

    Monday, September 9, 2013 7:11 AM

Answers

All replies

  • Hello, 

    Another weird behavior that I discovered with the buggy DriverPropertyBagTool.exe is when I swap entries in PropertySet.xml, the resulting propertybag.bag's size changes! (1.9MB vs 890KB)

    For example (other text removed for brevity):

    ...
    <Property Name = "KeyA">
        <String>
           <![CDATA[ KeyA Value ]]>
        </String>
    </Property>
    <Property Name = "KeyB">
        <String>
           <![CDATA[ KeyB Value ]]>
        </String>
    </Property>
    ... 


    to

    ...
    <Property Name = "KeyB">
        <String>
           <![CDATA[ KeyB Value ]]>
        </String>
    </Property>
    <Property Name = "KeyA">
        <String>
           <![CDATA[ KeyA Value ]]>
        </String>
    </Property>
    ...


    Monday, September 9, 2013 9:35 AM
  • Hi John,

    We were unable to reproduce your issues when we tried locally. We believe there may be an issue in your printer extension which is causing the first issue, and we're not sure about the second one. If you're still encountering this, can you please contact Microsoft Support so we can investigate? http://support.microsoft.com

    Thanks!

    Justin


    Monday, September 9, 2013 8:22 PM
  • Hello Justin,

    Thanks for your reply.

    I do believe that DriverPropertyBagTool.exe doesn't correctly handle large amounts of data. To demonstrate this, I have created a test program in Python that creates ten string properties each having a length of   300, 000 characters. The chosen characters are either uppercase ASCII characters or digits. For ten properties and 300k characters per property, it must surely amount to around ~3MB (2.86MB) of uncompressed data. The resulting property bag is only 986 KB. To rule out compression issues, I have compressed the data with 7-zip on maximum compression settings but it has only amounted to 1.89MB which is CLEARLY far from 986 KB. I can also rule out string interning because the strings are generated and the chance of strings matching another is just out of the question.

    Also, on another minor note, I think the tool doesn't correctly understand XML namespaces. 

    <?xml version='1.0' encoding='UTF-8'?>
    <ns0:Properties xmlns:ns0="http://schemas.microsoft.com/windows/2011/08/printing/driverpropertybag">
      <ns0:Property Name="PROPERTY_A_KEY">
        <ns0:String>PROPERTY A VALUE</ns0:String>
      </ns0:Property>  
    </ns0:Properties>

    This XML will fail in the tool.

    Python source code below (propertyset generator script):

    import random
    import xml.etree.ElementTree
    import string
    
    def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
        return ''.join(random.choice(chars) for x in range(size))
    
    namespace = "http://schemas.microsoft.com/windows/2011/08/printing/driverpropertybag"
    startXML = "<?xml version='1.0' encoding='UTF-8'?><Properties xmlns='" + namespace + "'></Properties>"
    
    tree = xml.etree.ElementTree.ElementTree()
    rootNode = xml.etree.ElementTree.fromstring(startXML)
    
    for i in xrange(10):
        propertyNode = xml.etree.ElementTree.fromstring(
            "<Property Name='PROPERTY_" + str(i) + "'><String>" + id_generator(300000) + " </String></Property>")    
        rootNode.append(propertyNode)
        
    tree._setroot(rootNode)
    
    #write to file
    tree.write('c:\\WINDOWS\\temp\\\\output.xml',encoding="UTF-8",xml_declaration=True)
    
        
    

    Thanks!

        

    Tuesday, September 10, 2013 1:36 AM
  • Hello,

    Any follow up on this?

    We were able to reproduce the problem again. Printer Extension crashes when it tries to call GetString() of the Driver Property Bag.  Randomly jumbling the XML elements can sometimes fix the issue but this is surely not the way to fix it, is it?

    Thank you.

    Tuesday, May 13, 2014 3:49 AM
  • Hi John,

    I'll log a bug in our internal bug system, but if you need a change to the tools on a particular timeline, please contact http://support.microsoft.com/ . They can work with our servicing team to request a fix if it's urgent.

    Thanks!

    Justin

    Thursday, May 15, 2014 5:17 PM