none
Adding content (images, .js, .pdf) to ISAPI web server of Compact 2013 device RRS feed

  • Question

  • Hi,

    I have created some web pages accessible through the web server of my Windows Embedded Compact 2013 platform.'

    These are setup as sub-projects and are using ISAPI.

    Formerly in Windows CE 5.0 I could simply add the .html, .jpg, .pdf etc.. files to the .BIB and they would all be visible and accessible on the web server.

    Now in Windows Embedded Compact 2013 I can see the .html files but the images don't show up and the .pdf files can't be opened either.

    The relevant part of my .bib file is below:

    FILES
    ;  Name            Path                                           Memory Type
    ;  --------------  ---------------------------------------------  -----------
    	webcfg-index.html			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-index.html							NK SH
    	webcfg-main.html			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-main.html							NK SH
    	webcfg-menu.html			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-menu.html							NK SH
    	webcfg-hdr_logo.jpg			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-hdr_logo.jpg						NK
    	webcfg-webcfg.css			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-webcfg.css							NK SH
    	webcfg-UserManual_Controller.pdf	$(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-UserManual_Controller.pdf			NK
    	

    Is there a new way of doing this?

    Should I be adding these as resource files rather than putting them in the .bib? - If so, how do I do this?

    Are there any good examples available for this?

    Thanks.


    • Edited by tomleijen Friday, September 5, 2014 12:35 AM
    Friday, September 5, 2014 12:34 AM

Answers

  • For completeness of this discussion, I solved the issue.

    When I ported the project to Compact 2013, I used the 2013 samples for ISAPI files, specifically isapigen.cpp which I took from C:\WINCE800\public\servers\oak\samples\natadmin\baseisapi

    This file is slightly different to the isapigen.cpp used originally in the project.

    When I replaced the original isapigen.cpp all the content became visible again.

    The only significant difference between the two files is that in 2013 this function was added:

    //  GenerateAllowedList reads all values in the registry key pRegList and outputs them out using cszGenerateHTML[] as a template
    //
    BOOL GenerateAllowedList(CISAPIResponse *pResp, CReg *pRegList, WCHAR *wszACL, PCSTR szResourceName, PCSTR szPostURL, PCSTR szDescription, DWORD dwFlags, PCSTR szExtraFormEntries) {
        SVSUTIL_ASSERT(szResourceName && szPostURL);
        SVSUTIL_ASSERT(pRegList->IsOK());
    
        if (RemoveTrailingStarFromUserList(wszACL,dwFlags)) {
            dwFlags |= GEN_LIST_ALLOW_DEFAULT;
        }
        CGenerateList cGenList(pRegList,wszACL,szResourceName,szPostURL,szDescription,dwFlags,szExtraFormEntries);
        return GenerateHTMLFile(cszGenerateHTML,pResp,&cGenList);
    }

    • Marked as answer by tomleijen Monday, November 24, 2014 6:48 PM
    Monday, November 24, 2014 6:48 PM

All replies

  • No changes in adding these files in .bib file for adding the image or any other file except kernel level driver, it should be mentioned as NK SHK.

    check the ce.bib file in the OSDEsign release directory, to know that your entries are added.


    Please mark as answer, if it is correct.
    Please vote,if it is helpful post.
    Vinoth.R

    http://vinoth-vinothblog.blogspot.com
    http://www.e-consystems.com/windowsce.asp

    Friday, September 5, 2014 6:11 AM
  • Hi Vinoth,

    Thanks for the reply.

    I'm not sure whether I understood it correctly but I changed my .dll to NK SHK and my .bib file looks like this:

    MODULES
    ; @XIPREGION IF PLATFORM_FILES_MISC
    WebConfig.dll  $(_FLATRELEASEDIR)\WebConfig.dll               NK SHK
    
    FILES
    ;  Name            Path                                           Memory Type
    ;  --------------  ---------------------------------------------  -----------
    	webcfg-index.html			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-index.html							NK SH
    	webcfg-main.html			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-main.html							NK SH
    	webcfg-menu.html			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-menu.html							NK SH
    	webcfg-hdr_logo.jpg			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-hdr_logo.jpg						NK
    	webcfg-webcfg.css			 $(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-webcfg.css							NK SH
    	webcfg-UserManual_Controller.pdf	$(_WINCEROOT)\3rdParty\WebConfig\Core\webcfg-UserManual_Controller.pdf			NK
    
    ; @XIPREGION ENDIF PLATFORM_FILES_MISC
    	

    I now get an error message "The server encountered an error." when I try to access the web page.

    If I change it so that the .dll is "NK" only, the web page shows up, as do the .html files, only I can't see the .jpg and download the .pdf files.

    Thanks.


    • Edited by tomleijen Sunday, September 7, 2014 8:49 PM
    Sunday, September 7, 2014 8:49 PM
  • Like Vinoth said; Check the ce.bib file in the FLATRELEASEDIR and make sure your files are indeed included.

    You may also need to mark them as U (uncompressed).


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Monday, September 8, 2014 3:20 AM
    Moderator
  • What is the purpose of WebConfig.dll? if it is simply calling some APIs, No need to keep it in Kernel space, you can simply add NK SH.

    Please mark as answer, if it is correct.
    Please vote,if it is helpful post.
    Vinoth.R

    http://vinoth-vinothblog.blogspot.com
    http://www.e-consystems.com/windowsce.asp

    Monday, September 8, 2014 6:03 AM
  • Hi Vinoth, Michael,

    Thanks for your suggestions.

    Vinoth,

    I didn't see why WebConfig.dll needed to be in kernel space, it seems to work fine (apart from images and pdfs) in user space, I was just trying it because in your previous comment you suggested using NK SHK flags - unless I understood that wrong.

    All in all the web interface is fully functional, I use it for manipulating registry keys and remotely rebooting the controller, only the images and pdf files don't work.

    Michael,

    I tried marking them all as uncompressed using the U flag, the .html files still work fine but there is no change to the .jpg and .pdf files, they still don't work.

    I checked ce.bib and they are included - I also know that they have been included because the .html files are there, just the images and pdfs don't show up on the web pages.

    Thanks

    Monday, September 8, 2014 6:19 AM
  • Are you copying them to the correct expected places? (using platform.dat)

    Is your html correct? Does it load the jpg from the right location?

    Can you see the images in your kernel? Can you open the jpg manually?


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Monday, September 8, 2014 6:23 AM
    Moderator
  • "H" also sets the files to hidden, which may be a blockade to debugging... I think I'd start with as few attributes on FILES as humanly possible and add them only as needed.

    Paul T.

    Monday, September 8, 2014 3:08 PM
  • Hi Michael and Paul,

    Thanks so much for your help.

    The files definitely seem to be being copied to the correct location, I can see them in my Windows folder on the FTP. They all have file names like "webcfg-clock.html".

    When I download the files back to my PC via FTP, all of them are perfectly fine, no corruptions what so ever.

    When I try to open the .html files by typing "http://172.16.55.175/webcfg/clock.html" the .html page shows up fine.

    When I try to open the .jpg files by typing "http://172.16.55.175/webcfg/hdr_logo.jpg" I just get some garbage data on the screen, the same goes for the .pdf documents where I get something like this:

    %PDF-1.5 %µµµµ 1 0 obj <>>> endobj 2 0 obj <> endobj 3 0 obj <>/Font<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/MediaBox[ 0 0 419.64 595.32] /Contents 4 0 R/Group<>/Tabs/S/StructParents 0>> endobj 4 0 obj <> stream xœXmoÛ6þnÀÿÀ¾HDóbQkœtíдYf`@ƒ|Õ1`KY¢tí°ß;ÊqEÉt´!ˆ Qwï¹£<{}߬?ˆ¼|9{Ý4Åò¶¼!W³E}w=[|»+gÅj]ͺ®^½"'§sò×tb•„ÁŸfÔÉ\5Ë©d¹Nfï¶ÅªÔä´&¿O''yɣΐÅçé„{WNd.¨OŽpdd…—_§“«„¤×dñÛtrîäì|Nf‘POꦩ·±hÛÙŁÙ9͉‘Tæj77£š	xw¿ê>]úhšry[ÕiÆy²IuR¯üí7÷ÿÂ-KðnYWKxPIy×ø÷$µ÷

    At the moment I am using the NK U flags only in my BIB file.

    Thanks

    Monday, September 8, 2014 9:37 PM
  • Do you have the jpg image viewer components selected and included? Same for pdf. If you can't decode jpg and/or pdf, you will see just garbage of course.

    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Monday, September 8, 2014 10:28 PM
    Moderator
  • Hi Michael,

    Thanks for your suggestion.

    I have SYSGEN_WGI_WIC (Windows Imaging Component) enabled, this should be enough to render the jpg images at least, are there any others that you would suggest?

    I have developed a few managed code applications with .jpg and .bmp images on them and they render fine on the screen of the device.

    I thought that it wouldn't matter anyway since I am viewing the web interface from my PC browser which should be doing the rendering of the (raw?) data sent across over HTTP. The browser is definitely not at fault since it displays the images on the same web interface from our CE 5.0 devices from which I have ported the code.

    I just think it's a very odd problem since the .html files work fine, only the .jpg and .pdf files don't.

    I'm wondering whether it has something to do with the code that converts the files from webcfg-hdr_logo.jpg to webcfg\hdr_logo.jpg only I'm struggling to find any sample code for WEC2013 and when I compile the code I don't get any warnings about deprecated functionality or similar.

    Thanks.

    Monday, September 8, 2014 11:15 PM
  • For completeness of this discussion, I solved the issue.

    When I ported the project to Compact 2013, I used the 2013 samples for ISAPI files, specifically isapigen.cpp which I took from C:\WINCE800\public\servers\oak\samples\natadmin\baseisapi

    This file is slightly different to the isapigen.cpp used originally in the project.

    When I replaced the original isapigen.cpp all the content became visible again.

    The only significant difference between the two files is that in 2013 this function was added:

    //  GenerateAllowedList reads all values in the registry key pRegList and outputs them out using cszGenerateHTML[] as a template
    //
    BOOL GenerateAllowedList(CISAPIResponse *pResp, CReg *pRegList, WCHAR *wszACL, PCSTR szResourceName, PCSTR szPostURL, PCSTR szDescription, DWORD dwFlags, PCSTR szExtraFormEntries) {
        SVSUTIL_ASSERT(szResourceName && szPostURL);
        SVSUTIL_ASSERT(pRegList->IsOK());
    
        if (RemoveTrailingStarFromUserList(wszACL,dwFlags)) {
            dwFlags |= GEN_LIST_ALLOW_DEFAULT;
        }
        CGenerateList cGenList(pRegList,wszACL,szResourceName,szPostURL,szDescription,dwFlags,szExtraFormEntries);
        return GenerateHTMLFile(cszGenerateHTML,pResp,&cGenList);
    }

    • Marked as answer by tomleijen Monday, November 24, 2014 6:48 PM
    Monday, November 24, 2014 6:48 PM