Re: mshtml

From: Sascha Sertel (sascha_at_ninaza.com)
Date: 07/01/04

  • Next message: Alvin Bruney [MVP]: "Re: mshtml"
    Date: Thu, 1 Jul 2004 08:31:04 -0700
    
    

    Hi there,

    > that's a security concern you are dealing with. what if a virus could do
    > what you are after. at midnight it fires a print with 10 million copies
    and
    > presses ok on the print dialog...

    I don't agree. While the security concern you are mentioning might be part
    of it, I still consider it a pure inconvenience, and Microsoft is not really
    consistent with this kind of behavior. For example, it is possible with a
    simple JavaScript or Python script to execute print functionality on any
    Internet Explorer window. Here is a sample Python script that will
    demonstrate what I mean:

    ------ Python Script start ---------

    import win32com.client
    from time import sleep
    # look in the makepy output for IE for the "CLSIDToClassMap"
    # dictionary, and find the entry for "ShellWindows"
    clsid = '{9BA05972-F6A8-11CF-A442-00A0C90A8F39}'

    # commands
    OLECMDID_PRINT = 6
    OLECMDEXECOPT_DONTPROMPTUSER = 2

    ShellWindows = win32com.client.Dispatch(clsid)

    # print the current IE document without prompting the user for the
    printerdialog
    ie = ShellWindows[1]

    ie.ExecWB(OLECMDID_PRINT,
              OLECMDEXECOPT_DONTPROMPTUSER)

    ------ Python Script end ---------

    If you execute the above script on a Python console, it will print the
    contents of the first Internet Explorer window (the second actually, since
    the index starts at 0, but the 0 window is usually the explorer instance
    that is used for the taskbar etc.) without asking for anything. It's even
    easier than a virus to put that on a webpage and have 1 million copies of
    the webpage printed. The only thing which is not possible is to chose the
    printer like that, it will always take the default printer.

    There are other examples, for instance Microsoft Outlook. Usually Outlook
    will ask you if you want to allow access to another program if it tries to
    access the inbox or send an email. But this is only true as long as you use
    a certain Outlook Application object. In the knowledgebase they explain
    exactly that you can also use a different Outlook object which will not ask
    any questions and just execute what you want.

    As for Gregor's initial question, it's probably true that you cannot pass
    that DONTPROMPTUSER value ther somehow, but if you can just open your HTML
    document in an (invisible) Internet Explorer instance and use a mechanism
    like shown above (it's also possible in JavaScript and VBScript) you should
    be able to print your HTML file without showing a print dialog.

    Sorry for the ranting, but security should be implemented through proper
    authorization mechanisms, not through missing functionality.

    Sascha


  • Next message: Alvin Bruney [MVP]: "Re: mshtml"

    Relevant Pages

    • Re: mshtml
      ... "Sascha Sertel" wrote in message ... > contents of the first Internet Explorer window (the second actually, ... for instance Microsoft Outlook. ... > document in an Internet Explorer instance and use a mechanism ...
      (microsoft.public.office.developer.web.components)
    • Re: when clicking on link in email blank screen appears
      ... You Cannot Open New Internet Explorer Window ... This is a group to support Outlook from the Office group of programs. ... Outlook Express is a part of Internet Explorer and is a quite different ... If those groups aren't carried on the news server that's carrying this group ...
      (microsoft.public.outlook)
    • Re: Printing
      ... Cannot Print from Internet Explorer or Outlook Express ... 281679 - You Cannot Open New Internet Explorer Window or Nothing Happens ... Error Message When You Attempt to Print a Web Page: ...
      (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
    • Internet explorer wont start properly
      ... I can only get internet explorer to start when I start it as administrator, ... if I try starting it either from outlook or simply by ... clicking on the e the internet explorer window opens... ... minutes I get an error message telling me that an error has occured and ...
      (microsoft.public.de.windows.vista.sonstiges)
    • Re: internet explorer
      ... Remove the ISP branding for Internet Explorer and Outlook Express ... How to Change the Internet Explorer Window Title ...
      (microsoft.public.windowsxp.general)