Windows 7 weather gadget

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 14
    ultimate x64
       #11

    I checked default gadget and modified gadget and both of them seems trying to get information from 'weather.service.msn.com'. Server seems operating normally. I suspect wlsrvc.dll makes error.
      My Computer


  2. Posts : 14
    ultimate x64
       #12

    If anyone still wondering about the original weather gadget, I made it working by modifying server's response. Gadget seems can't decode UTF-16 encoding. I used pydivert to modify request(for response is not being zipped) and response.

    Code:
    import pydivert
    
    print("started")
    
    
    with pydivert.WinDivert("tcp.SrcPort == 80 or tcp.DstPort == 80") as w:
            for packet in w:
                    
                    
                    payload = packet.tcp.payload
    
    
                    if packet.is_inbound:
                            payload = payload.replace(b"<?xml version=\"1.0\" encoding=\"utf-16\"?><weatherdata>",b"<?xml version=\"1.0\" encoding=\"utf-8\"?> <weatherdata>")
                    if packet.is_outbound:
                            payload = payload.replace(b"Accept-Encoding: gzip, deflate", b"Accept-Encoding: ")
    
                    packet.payload = payload
                    packet.recalculate_checksums(0)
                    
                    w.send(packet,recalculate_checksum=True)
      My Computer


  3. Posts : 2
    Win 10 x64
       #13

    sh20000sh said:
    If anyone still wondering about the original weather gadget, I made it working by modifying server's response.

    Gadget seems can't decode UTF-16 encoding. I used pydivert to modify request(for response is not being zipped) and response.

    Code:
    import pydivert
    
    print("started")
    
    
    with pydivert.WinDivert("tcp.SrcPort == 80 or tcp.DstPort == 80") as w:
            for packet in w:
                    
                    
                    payload = packet.tcp.payload
    
    
                    if packet.is_inbound:
                            payload = payload.replace(b"<?xml version=\"1.0\" encoding=\"utf-16\"?><weatherdata>",b"<?xml version=\"1.0\" encoding=\"utf-8\"?> <weatherdata>")
                    if packet.is_outbound:
                            payload = payload.replace(b"Accept-Encoding: gzip, deflate", b"Accept-Encoding: ")
    
                    packet.payload = payload
                    packet.recalculate_checksums(0)
                    
                    w.send(packet,recalculate_checksum=True)
    Is possible to modify gadget file directly? example modify the js files (weather.js) to redirect this?
      My Computer


  4. Posts : 14
    ultimate x64
       #14

    jhonny82 said:
    Is possible to modify gadget file directly? example modify the js files (weather.js) to redirect this?
    Looks like it gets data from server via ActiveXobject. Code that we need to touch are not visible on .js files.

    - - - Updated - - -

    I added code to make target packet more specific. I compiled it into exe and makes it running background via task scheduler. Other network activity works smoothly and gadget activity is bit jamming but at least works.

    Code:
                    payload = packet.tcp.payload
            
            if len(payload) == 0:
                w.send(packet)
            if payload.find(b"weather") == -1:
                w.send(packet)
    
    
    
    
                    if packet.is_inbound:
    - - - Updated - - -

    And now, sever removed first tag that saying about UTF-16. It'll work without packet modifying I think.

    - - - Updated - - -

    As server removed header tag so it is working on weather displaying. But I thought about broken search feature on weather gadget. Interestingly, it works searching by zip code. So I compared results and result from name search lack of variable zipcode.
    Code:
    import pydivert
    
    
    print("started")
    
    
    
    
    with pydivert.WinDivert("tcp.SrcPort == 80 or tcp.DstPort == 80") as w:
            for packet in w:
                    
                    
                    payload = packet.tcp.payload
    
    
                    if len(payload) == 0:
                            w.send(packet)
                    if payload.find(b"weather") == -1:
                            w.send(packet)
    
    
                    if packet.is_inbound:
                            if payload.find(b"zipcode") != -1:
                                    w.send(packet)
                            if payload.find(b"weatherfullname") == -1:
                                    w.send(packet)
                            payload = payload.replace(b"weatherfullname",b"zipcode=\"\" weatherfullname")
                            payload = payload.replace(b"searchlocation",b"ion")                      
                    if packet.is_outbound:
                            if payload.find(b"find.aspx") == -1:
                                    w.send(packet)
                            if payload.find(b",%20") != -1:
                                    w.send(packet)
                            payload = payload.replace(b"Accept-Encoding: gzip, deflate", b"Accept-Encoding: ")
    
    
                    packet.payload = payload
                    packet.recalculate_checksums(0)
                    
                    w.send(packet,recalculate_checksum=True)
    I had to touch name of variable "searchlocation" for not breaking XML structure by adding variable "zipcode". Which is used on search by location. So I had to make an exception when search query includes ",%20" (comma and space) for search by latitude and longitude.
    Windows 7 weather gadget-capture.png
    After running packet modifier, it works now!

    - - - Updated - - -

    And I found it during debugging, I found when search query includes ", "(,%20), it works with original response. So if you want use search from original weather gadget, add comma and space for no reason to make search works. It was done because comma was processed before sending query.
      My Computer


  5. Posts : 14
    ultimate x64
       #15

    Possible errors are found when packet is divided on targeted string, or some of search results includes object that lack of variable "weatherlocationname". As this workaround is modifying data during transmission, I think won't fix them for performance.
      My Computer


  6. Posts : 2
    Win 10 x64
       #16

    sh20000sh said:
    Possible errors are found when packet is divided on targeted string, or some of search results includes object that lack of variable "weatherlocationname". As this workaround is modifying data during transmission, I think won't fix them for performance.
    Now seems to work again without any modification....
      My Computer


  7. Posts : 14
    ultimate x64
       #17

    jhonny82 said:
    Now seems to work again without any modification....
    Gadget itself was became working since last week. After that, I changed its code for its "Select current location" feature.
      My Computer


  8. Posts : 4
    Windows 7 Ultimate x64
    Thread Starter
       #18

    sh20000sh said:
    Gadget itself was became working since last week. After that, I changed its code for its "Select current location" feature.
    Are you saying that the gadget work for you now without a fix? Or it works after what you have done. How could I do what you did on my pc, to get the gadget working again? Currently it is not working for me.
      My Computer


  9. Posts : 14
    ultimate x64
       #19

    Jeff 100 said:
    Are you saying that the gadget work for you now without a fix? Or it works after what you have done. How could I do what you did on my pc, to get the gadget working again? Currently it is not working for me.
    Displaying weather would be work now without a fix, as weather.service.msn.com result removed first XML tag that causes malfunctioning. (example - it should start with <weatherdata> tag when viewing page source. When it was broken, it was starting with <?xml version="1.0" encoding="utf-16"?> and gadget couldn't decode utf-16.)

    What I currently applied is on post #14, which is some kind of additional fix for searching location feature, which I done is compile its python code to .exe (with admin privilege required) via pyinstaller and made it running background.

    If it is still not working for you, try some old workaround. Such as emptying AppData\Local\Microsoft\Windows Sidebar\Cache\

    I tried location on first post, it should be look like this now.
    Windows 7 weather gadget-capture.png
      My Computer


  10. Posts : 434
    Windows 7 Home Premium 64-bits
       #20

    How does it compare to the one that comes with 8GadgetPack?
      My Computers


 
Page 2 of 3 FirstFirst 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 19:53.
Find Us