Announcement

Collapse
No announcement yet.

Win32API call

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Win32API call

    Is it possible to call Win32 API directly using inline assembler
    in PB/DOS without a special designed VxD Driver?

  • #2
    There are some INT calls that can be made to access some of the simpler
    Win32 functionality, such as long filenames. See Ralf Brown's interrupt
    list:

    http://www-2.cs.cmu.edu/afs/cs/user/ralf/pub/WWW/


    You can find some examples in the Downloads section here:

    http://www.powerbasic.com/files/pub/pbdos/


    It is not possible to call the Win32 API itself from a DOS program.


    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment


    • #3

      On 20 May 03, in article "Re: Win32API call", Tom Hanlin wrote:

      Hello Tom,

      > It is not possible to call the Win32 API itself from a DOS program.

      It depends, but that would be a solution for NT/W2k/XP only.

      Regards,

      --------------
      / h o m a s
      ------------------
      email : [email protected] / mailto:[email protected][email protected]</A> (PGP-Key available)
      www : www.gohel.de / http://pbsound.basicguru.com (PowerBASIC)
      fax/bbs: +49-30-47300910 (VFC, V34+, X75, ISDN, CCB, 9600-128000bps)
      ## CrossPoint [XP2] v3.31.003 Beta DOS/16 R/C2478, via PBNEWS v0.18g
      http://www.gohel.de - http://www.gohel.net - http://www.pbhq.com

      Comment


      • #4
        Just kind of thinking out loud here...

        Since one <U>can</U> SHELL a Windows program from an MS-DOS program, seems to me someone "could" create a Windows program designed to be shelled, call the WinAPI, and return the data..

        The MS-DOS program could create, and the windows program read, a disk file with records something like...
        Code:
        UNION ParmTypeUnion
          L       AS LONG
          I       AS INTEGER
          SZ      AS ASCIIZ * 256
          etc...
        END UNION
        
        TYPE ApiCallParmsType
          DataType       AS LONG  ' %PARM_TYPE_INT, %PARM_TYPE_SZ, %PARM_TYPE_UDT, etc...
          ParmValue      AS ParmTypeUNION
          Parm_Length    AS LONG  ' for parm_type_udt
          Parm_Ref       AS LONG  ' %PARM_BYREF or %PARM_BYVAL
        END TYPE
        
        TYPE ApiCallType
         Libname   AS    ASCIIZ * 260
         ProcName  AS    ASCIIZ * 128
         Parms (1 to 10) AS ApiCallParmsType
         ReturnValue     AS LONG   ' All Win API calls return a 32-bit value
        END TYPE
        The MS-DOS program would build the record above; the Windows program would accept the filename as a parameter, e.g., in the MS-DOS program....
        Code:
           SHELL "APICALL  parmfile.txt"
        The Windows program would read the file, Use LoadLibrary, GetProcAddress and CALL DWORD to make the call, update the passed parameters, and fill the return value field.

        Obviously needs a bit more thought, but it's an idea..

        MCM
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Sounds much like what the RUNDLL32.EXE app does, but with more finesse...

          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6

            On 14 Jun 03, in article "Re: Win32API call", Michael Mattias wrote:

            Hello Michael,

            > Since one _can_ SHELL a Windows program from an MS-DOS program, seems
            > to me someone "could" create a Windows program designed to be
            > shelled, call the WinAPI, and return the data..

            Nope, Michael.

            Microsoft has documented an offical/inoffical way with an illegal
            opcode (!db &hC4, !db &hC4). Mhhhh, look for the sourcecode to
            NTOLDAPP.

            Regards,

            --------------
            / h o m a s
            ------------------
            email : [email protected] / mailto:[email protected][email protected]</A> (PGP-Key available)
            www : www.gohel.de / http://pbsound.basicguru.com (PowerBASIC)
            fax/bbs: +49-30-47300910 (VFC, V34+, X75, ISDN, CCB, 9600-128000bps)
            ## CrossPoint [XP2] v3.31.003 Beta DOS/16 R/C2478, via PBNEWS v0.18g
            http://www.gohel.de - http://www.gohel.net - http://www.pbhq.com

            Comment


            • #7
              Can you expand your answer on that Thomas, please? BTW, a google.com search for "NTOLDAPP code" or "NTOLDAPP source" in both groups and the web yields no hits...?

              Are you implying that you cannot SHELL from a DOS app to a Windows app???

              Thanks!


              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                NTOLDAPP gives DOS applications access to the clipboard under NT.
                I think the source is posted at SourceForge.

                http://ntvdm.sourceforge.net/

                [added link]



                [This message has been edited by John McWilliams (edited June 17, 2003).]

                Comment


                • #9

                  On 16 Jun 03, in article "Re: Win32API call", Lance Edmonds wrote:

                  Hello Lance,

                  > Can you expand your answer on that Thomas, please? BTW, a
                  > google.com search for "NTOLDAPP code" or "NTOLDAPP source" in both
                  > groups and the web yields no hits...?

                  Mhh, mysterious.

                  > Are you implying that you cannot SHELL from a DOS app to a Windows
                  > app??? ?-)

                  You misunderstood me, Lance ...

                  In fact: It is possible to make an Win32API-CALL within a plain
                  DOS programm (via ntvdm.exe and the illegal opcode &hC4C4, instead
                  SHELL).

                  Do you need an example or a real application (not PB)?

                  Regards,

                  --------------
                  / h o m a s
                  ------------------
                  email : [email protected] / mailto:[email protected][email protected]</A> (PGP-Key available)
                  www : www.gohel.de / http://pbsound.basicguru.com (PowerBASIC)
                  fax/bbs: +49-30-47300910 (VFC, V34+, X75, ISDN, CCB, 9600-128000bps)
                  ## CrossPoint [XP2] v3.31.003 Beta DOS/16 R/C2478, via PBNEWS v0.18g
                  http://www.gohel.de - http://www.gohel.net - http://www.pbhq.com

                  Comment


                  • #10
                    [QUOTE]Originally posted by Thomas Gohel:
                    [B]
                    On 16 Jun 03, in article "Re: Win32API call", Lance Edmonds wrote:

                    >In fact: It is possible to make an Win32API-CALL within a plain
                    >DOS programm (via ntvdm.exe and the illegal opcode &hC4C4, instead
                    >SHELL).

                    >Do you need an example or a real application (not PB)?

                    It's magic I really need both!


                    ------------------

                    Comment


                    • #11
                      Hi all,
                      I found some information about how to call Win32 API using inline assembler in PB/DOS running in WinNT/2000/XP virtual DOS machine.

                      Here it is:
                      http://www.xakep.ru/post/21508/default.asp
                      http://www.r-i-p.info/artview.php?id=592
                      http://www.peterburg.h1.ru/other/c4c4.html


                      Three web sites seem to talk about the same thing but none of them is in English.
                      Any one can help me to translate that into English?
                      Any one can help to write a PB/DOS program call to win32API shows a "Hello world!" window?

                      -------------------------------------------------------
                      C4C4: êàê ïîäâåñèòü NT
                       ýòîé ñòàòüå áóäåò ðàññêàçàíî ïðî óÿçâèìîñòü, íàéäåííóþ â îïåðàöèîííûõ ñèñòåìàõ Windows NT/2000/XP, ïðè÷¸ì â íå NT ñèñòåìàõ íåò äàííîé óÿçâèìîñòè. Ðå÷ü ïîéä¸ò î ðåàëèçàöèè âèðòóàëüíîé DOS ìàøèíû â ýòèõ îïåðàöèîííûõ ñèñòåìàõ. Êàê æå ñòàðîå 16 áèòíîå ïðèëîæåíèå äëÿ DOS, çàïóùåííîå â Windows NT, ñîîáùàåò åé ÷òî èìåííî íóæíî äåëàòü - ÷èòàòü ôàéëû, âûâîäèòü íà êîíñîëü ñèìâîëû, èçìåíÿòü ãðàôè÷åñêèé ðåæèì? Âñ¸ ýòî ïðîèñõîäèò â ÿäðå ñèñòåìû. Îêàçûâàåòñÿ, ðàçðàáîò÷èêè Windows NT/2000/XP ïðèäóìàëè äëÿ ýòîãî èíòåðåñíûé ñïîñîá - îíè èñïîëüçóþò íåêîððåêòíóþ èíñòðóêöèþ, îíà âûçûâàåò èñêëþ÷åíèå #UD - Faulf , à ïîñëå ýòîé èíñòðóêöèè ðàñïîëîæåíà äîïîëíèòåëüíàÿ èíôîðìàöèÿ, ñàì êîä èíñòðóêöèè èä¸ò êàê ñèãíàòóðà - òî ÷òî ýòî èìåííî âûçîâ ñåðâèñà, à äàëåå ÷òî èìåííî òðåáóåòñÿ, îñòàëüíûå âõîäíûå ïàðàìåòðû íàõîäÿòñÿ â ðåãèñòðàõ ïðîöåññîðà. Òåïåðü ïîäðîáíåå ïðî èíñòðóêöèþ ïðîöåññîðà, êîòîðóþ îíè ðåøèëè èñïîëüçîâàòü. Èíñòðóêöèÿ LES - íåïðèâèëåãèðîâàííàÿ èíñòðóêöèÿ ïîëüçîâàòåëÿ, ïðåäíàçíà÷åíà äëÿ çàãðóçêè äàëüíåãî FAR óêàçàòåëÿ â ðåãèñòðû ES (ñåãìåíòíàÿ ÷àñòü, èëè ñåëåêòîð) è ïåðâûé ïàðàìåòð êîìàíäû (ñìåùåíèå). Âòîðûì ïàðàìåòðîì êîìàíäû îáÿçàòåëüíî äîëæíà áûòü ïàìÿòü - îòòóäà è ñ÷èòûâàåòñÿ äàëüíèé óêàçàòåëü. Èòàê ôîðìàò êîìàíäû:

                      LES R16/32,Mem32/48

                      Åñëè íå ñ÷èòàòü âîçìîæíûõ ïðåôèêñîâ ïåðåä, òîãäà êîä èíñòðóêöèè áóäåò òàêèì:

                      C4 xx rrr mmm ...

                      C4 - ýòî ïåðâûé áàéò äàííîé êîìàíäû, âñåãäà òàêîé, åñëè C4 - çíà÷èò ýòî LES. Äàëåå èä¸ò âàæíûé áàéòèê (mod/reg/mem), xx - åãî ñòàðøèå äâà áèòà, rrr - ñðåäíèå òðè áèòà è mmm - ìëàäøèå òðè áèòà, â ýòîì áàéòå çàäàíû àðãóìåíòû èíñòðóêöèè. Íå áóäåì òóò ñèëüíî óãëóáëÿòüñÿ â ñòðóêòóðó êîìàíä Intel, â äàííîì ñëó÷àå íóæíî çíàòü òîëüêî, ÷òî åñëè ñòàðøèå äâà áèòà xx ðàâíû 11, çíà÷èò âòîðîé àðãóìåíò êîìàíäû ðåãèñòð, åñëè æå îíè íå ðàâíû 11, çíà÷èò âòîðîé àðãóìåíò ïàìÿòü. Íî ó èíñòðóêöèè LES íå ìîæåò áûòü âòîðîãî ðåãèñòðîâîãî àðãóìåíòà! ×òî áóäåò åñëè óêàçàòü äëÿ íå¸ âî âòîðîì áàéòå ñòàðøèå äâà áèòà ðàâíûå 11? À áóäåò íåêîððåêòíàÿ èíñòðóêöèÿ è ïðè ïîïûòêå èñïîëíåíèÿ ïîëó÷èì #UD - Faulf. Èòàê, ðàçðàáîò÷èêè ðåøèëè ïîñòóïèòü èìåííî òàê è âòîðîé áàéò ðàâåí òîæå C4 - ñðàçó âèäíî ëþäè ëþáÿò êðàñîòó, äàæå òóò ãäå ìàëî êòî ìîæåò å¸ çàìåòèòü. Èíñòðóêöèÿ ñ êîäîì C4 C4.

                      C4 C4 ; êðàñîòà òî êàêàÿ

                      Ýòî äèçàññåìáëèðóåòñÿ òàê (íåêîððåêòíî, íî âñ¸ òàêè):

                      LES AX,SP

                      C4h = 11000100b => 11 - > âòîðîé îïåðàíä ðåãèñòð, 000 - ïåðâûé îïåðàíä ðåãèñòð ñ íîìåðîì 0, 100 - âòîðîé îïåðàíä ðåãèñòð ñ íîìåðîì 4 => èòîã - ïåðâûé ýòî AX, âòîðîé ýòî SP.

                      Òàê âîò, ïîñëå áàéòîâ C4 C4 ñëåäóåò åù¸ îäèí áàéò (íàâåðíî âñåãäà îäèí), îí êàê ðàç è åñòü íîìåð ñåðâèñà, ïàðàìåòðû âûçîâà íàõîäÿòñÿ â ðåãèñòðàõ ïðîöåññîðà è îáðàáîò÷èê èñêëþ÷åíèÿ ïîëó÷èò èõ çíà÷åíèÿ, âûïîëíèò íåîáõîäèìûå äåéñòâèÿ è ñíîâà ñîâåðøèò âîçâðàò è ïðîöåññ, íî óæå êîíå÷íî ïðîïóñòèò ýòè áàéòû è óïðàâëåíèå áóäåò ïåðåäàíî äàëüøå. Ïîñìîòðèì ïðèìåðû êîäà âçÿòîãî èç DOS ñðåäû, ðîæä¸ííîé â Windows XP.

                      push si
                      xor si,si
                      db 0C4h,0C4h,17h
                      pop si

                      ;####

                      xor si,si
                      db 0C4h,0C4h,17h
                      test ah,8
                      jz short ...

                      ;####

                      push si
                      push dx
                      mov si,0FFFFh
                      db 0C4h,0C4h,17h

                      ;####

                      Ôðàãìåíò âçÿò èç äàìïà ïàìÿòè, òóò ÿñíî âèäíî, ÷òî ýòî ÿâíî êàêîé-òî ñåðâèñ 17h, ïðè÷¸ì îí ïîëó÷àåò ïàðàìåòð â ðåãèñòðå SI.

                      mov ah,002h
                      db 0C4h,0C4h,16h

                      lab_00002C09:

                      mov bx,[0001Ah]
                      cmp bx,[0001Ch]
                      jnz short lab_00002C2A
                      mov ax,cs:[009B8h]
                      cmp ax,cs:[009C0h]
                      jnb short lab_00002C25
                      inc word ptr cs:[009BCh]
                      jmp short lab_00002C09

                      lab_00002C25:

                      mov ah,001h
                      db 0C4h,0C4h,16h

                      lab_00002C2A:

                      pop ax
                      retn

                      Òîæå ïðèìåð, íî óæå ñåðâèñ 16h è ÿñíî âèäíî, ÷òî íà ýòîò ðàç ïàðàìåòð â AH. È òàêèõ ìåñò î÷åíü ìíîãî, ýòî äåéñòâèòåëüíî íå ìóñîð è âñ¸ òàê êàê ÿ íàïèñàë, åñëè ïðîõîäèòü äàííûå ìåñòà ïîä îòëàä÷èêîì, òî âñ¸ ðàáîòàåò è ñîçäà¸òñÿ âïå÷àòëåíèå, ÷òî ýòî êàêèå-òî ñïåöèàëüíûå èíñòðóêöèè ïðîöåññîðà, îí ïîñëóøíî èõ îáðàáàòûâàåò è ïðîïóñêàåò ðîâíî ñêîëüêî áàéòîâ, ñêîëüêî íàäî, íî ýòî òîëüêî òàê êàæåòñÿ - ýòî ýìóëèðóåòñÿ îïåðàöèîííîé ñèñòåìîé.

                      db 0C4h,0C4h,0FEh
                      push ax
                      xor ax,ax
                      db 0C4h,0C4h,9h
                      pop ax

                      Âîò åù¸ ïðèìåð. Íàâåðíî âñåãäà âûçîâ âûãëÿäèò òàê C4 C4 i8 , òî åñòü ïëîõàÿ èíñòðóêöèÿ è åù¸ îäèí áàéò - íîìåð ñåðâèñà.

                      push ax
                      mov ax,013FEh
                      db 0C4h,0C4h,42h
                      pop ax
                      clc
                      dec word ptr cs:[00804h]
                      retn

                      ;####

                      push ax
                      mov ax,00001h
                      db 0C4h,0C4h,59h
                      pop ax
                      mov ah,080h
                      stc
                      retf 00002h

                      Òàêèõ ïðèìåðîâ ìîæíî ïðèâåñòè ìíîãî. Êàê âèäíî íîìåð ñåðâèñà - áàéò ïîñëå C4 C4 - òïðèíèìàåò ðàçëè÷íûå çíà÷åíèÿ, íî íàâåðíî íå âñå âîçìîæíûå, ÿ íàïðèìåð íåêîòîðûå òàê è íå íàø¸ë. Íàïðèìåð íóëåâîå çíà÷åíèå òàê è íå áûëî íàéäåíî âî âñ¸ì ìåãàáàéòå DOS îáðàçà. Èíòåðåñíî, ÷òî æå áóäåò åñëè ñäåëàòü òàêîé âûçîâ !?

                      mov di,0041Dh
                      mov cx,00004h
                      mov ax,0BEEFh
                      db 0C4h,0C4h,5Fh
                      jc short lab_00002646

                      È âîò ÿ âçÿë äà è íàïèñàë ìåëåíüêèé .COM ôàéëèê ñëåäóþùåãî ñîäåðæàíèÿ:

                      C4 C4 00 C3

                      È çàïóñòèë åãî - êîíñîëü óìåðëà. Òåïåðü ïðèáèâàåì êîíñîëü è çàïóñêàåì ÷òî-íèáóäü 16 áèòíîå, ÷òîáû NTVDM.EXE çàïóñòèëñÿ. È òåïåðü ñíîâà âûïîëíÿåì ìàëåíüêèé ôàéëèê - NTVDM.EXE âûâåëà ñîîáùåíèå: Çàãîëîâîê îêíà: 16 bit MS-DOS Subsystem, à â ñàìîì îêíå: NTVDM has encountered a System Error. Acsess is denied. Íåçàâèñèìî îò îòâåòà íà ýòî îêîøêî êîíñîëü ïðîäîëæàåò âèñåòü, íî ëåãêî ïðèáèâàåòñÿ, èëè ñàìà èñ÷åçàåò ñî âðåìåíåì. Çàïîìíèì, ÷òî ñàìà êîíñîëü ñîâñåì ì¸ðòâàÿ è íè íà ÷òî íå ðåàãèðóåò, õîòÿ îêíî ìîæíî çàêðûòü. Ïðè ýòîì çàíÿòîñòü ïðîöåññîðà íå ìåíÿåòñÿ. Íåìíîãî ïîçæå ìíå ïðèøëà õîðîøàÿ èäåÿ - ïåðåä èñïîëíåíèåì ïëîõîé èíñòðóêöèè ñ íåâåðíûì íîìåðîì ñåðâèñà íóæíî ðàçâåðíóòü êîíñîëü íà âåñü ýêðàí, ïðè÷¸ì âûçîâîì ÷åãî-íèáóäü èç ýòîé æå ñðåäû, íàïðèìåð íà䏿íî ðàáîòàåò ñìåíà ðåæèìà êîíñîëè íà ãðàôè÷åñêèé ðåæèì, íó âîò íàïðèìåð ñòàðåíüêèé 13h îò ïðåðûâàíèÿ 10h. Ïèøåì ñëåäóþùèé êîä:

                      mov ax,13h
                      int 10h
                      db 0C4h,0C4h,0

                      Òåïåðü âñ¸ ýòî â .COM ôàéë è ïîëó÷èì âîò ÷òî:

                      B8 13 00 CD 10 C4 C4 00

                      Ýòî ïðîñòî ïðåâçîøëî âñå îæèäàíèÿ !!! Çàïóñêàåì è... Ñíà÷àëà êîíñîëü ðàçâîðà÷èâàåòñÿ íà âåñü ýêðàí, à ïîñëå áëîêèðóåòñÿ, ïðîñòî óìèðàåò è íå ðåàãèðóåò óæå ñîâñåì íè íà ÷òî! Äàæå CTRL-ALT-DEL íå ñïàñ¸ò, âïðî÷åì íå ïîìîæåò è ñëåäóþùåå: ALT-TAB, ALT-BLANK, ALT-ENTER, WINKEY, è òàê äàëåå... Òîëüêî ëèøü íà âåðøèíå ýêðàíà óæå â ãðàôè÷åñêîì ðåæèìå âèäíû êóñêè ìóñîðà, ïðîöåññîð íå âèñèò, îñòàëüíûå ïðèëîæåíèÿ íîðìàëüíî ïðîäîëæàþò ðàáîòàòü - ó ìåíÿ ìåäèà ïëåéåð èãðàë â ýòî âðåìÿ. Íî ïîëüçîâàòåëü íè÷åãî íå ìîæåò ñäåëàòü! Ýòà âåùü ðàáîòàåò âåçäå - ïîä àäìèíîì, ïîä ïîëüçîâàòåëåì ñ îãðàíè÷åííûìè ïðàâàìè è ïîä ãîñòåì òîæå. Òàêîå ñîñòîÿíèå ïðîäîëæàåòñÿ ïðèìåðíî ìèíóò ïÿòü è áîëüøå, ïîòîì îïåðàöèîííàÿ ñèñòåìà ñàìà ïîíèìàåò ÷òî ÷òî-òî íå òàê è ïûòàåòñÿ ñíÿòü çàäà÷ó, ÷òî òîæå ïîëó÷àåòñÿ íå ñðàçó.

                      Òîæå èíòåðåñíîå ïîâåäåíèå íàáëþäàåòñÿ åñëè ñíà÷àëà çàïóñòèòü íàïðèìåð Volkov Commaned, òîëüêî íå â ïîëíîýêðàííîì ðåæèìå, à òàê ÷òîáû êîíñîëüêà áûëà îòäåëüíûì îêíîì íå íà âåñü ýêðàí. Ïîòîì èñïîëíÿåì èç íåãî ïåðâûé ôàéëèê (äîñòàòî÷íî òîëüêî C4 C4 00), ïðè ýòîì êîíñîëü òîæå óìèðàåò, íî îñòà¸òñÿ ìàëåíüêîé, òåïåðü å¸ ìîæíî ðàçâåðíóòü íà âåñü ýêðàí ñ ïîìîùüþ ALT-ENTER, íî âîò ñâåðíóòü îáðàòíî íå ïîëó÷èòñÿ - êîíñîëü óìåðëà è çàíèìàåò âåñü ýêðàí, òîëüêî ìèãàþùèé êóðñîð âíèçó ýêðàíà áóäåò íåðâèðîâàòü âàñ åù¸ ìèíóò ïÿòü, âñå íàæàòèÿ íà êëàâèøè áåñïîëåçíû, íî íå ñîâåòóþ ìíîãî ÷åãî íàæèìàòü, òàê êàê êîãäà îïåðàöèîííàÿ ñèñòåìà áóäåò ïðèáèâàòü ýòî ïðîöåññ îíà âûïîëíèò âñå íàæàòèÿ ÷òî áûëè ñîâåðøåíû âî âðåìÿ áëîêèðîâêè. Êàê æå ýòî ìîæíî èñïîëüçîâàòü ? Ïîäóìàéòå ñàìè è ÿ óâåðåí, ÷òî íàéä¸òå èíòåðåñíîå ïðèìåíåíèå. Äàííàÿ âåùü ïðîâåðÿëàñü íà Windows NT, Windows 2000, Windows XP. È ïðèâîäèëà â øîê âñåõ êòî ýòî âèäåë, ïîäâåñèòü Windows NT ýòî êîíå÷íî íàäî ïîñòàðàòüñÿ, íî ÷òîáû òàê ïîäâåñèòü íóæíî ñèëüíî-ñèëüíî ïîñòàðàòüñÿ. Ýòó óÿçâèìîñòü ÿ íàø¸ë â ïåðâûé ðàç ÷åòûðå ãîäà íàçàä â Windows NT ñ øåñòûì ñåðâèñ ïàêîì, ïîçæå ÿ ïðîâåðèë ýòî íà Windows 2000 è Windows XP è âñ¸ ðàáîòàëî, íàâåðíî îøèáêó óïîðíî íå õîòÿò çàìå÷àòü óæå íåñêîëüêî ëåò ïîäðÿä, ÿ òàêæå íèãäå íå âèäåë óïîìèíàíèÿ îá ýòîì ñâîéñòâå ñèñòåì Windows NT.  îáùåì èñïîëüçóéòå êàê òîëüêî ñìîæåòå ïðèäóìàòü, âîçìîæíî â ýòîì íàïðàâëåíèè ìîæíî ÷òî-òî åù¸ ðàñêîïàòü ...




                      [This message has been edited by CC Tung (edited June 14, 2005).]

                      Comment


                      • #12
                        >Any one can help to write a PB/DOS program call to win32API shows a "Hello world!" window?

                        1. If you are on a system with Windows available, why bother? If it's just one call, the SHELL/assembly language equivalent thereof will surely be adequate.

                        2. I cannot believe your real goal is to show a "Hello World" window. What are you trying to accomplish? Maybe someone knows how to do it from PB/DOS without calling on Windows.

                        If the goal is "satisfy my curiosity," that's OK, but you need to say so; if this is an application not considering another method of reaching that goal would be derelict.


                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #13
                          Hi, Michael
                          >1. If you are on a system with Windows available, why bother? If it's just one call, the SHELL/assembly language equivalent thereof will surely be adequate.

                          >2. I cannot believe your real goal is to show a "Hello World" window. What are you trying to accomplish? Maybe someone knows how to do it from PB/DOS without calling on Windows.

                          Yes. This is just the little goal. My goal is writting windows application with PB/DOS.
                          Why using PB/DOS? Why not using Visual studio? BCB? VB?
                          Because:
                          1. I am a DOS/Assembly/BASIC fan.
                          2. I love BASIC and PB/DOS.
                          3. I can't write win apps at this moment and I am learning.
                          4. I like to learn windows programming from WIN32 API not MFC, OWL ...etc at beginning.
                          and I like to learn it using PB/DOS, because I love it. I want to spend more time with it.
                          5. I bought PB/DOS for two years, and I didn't use it since I got it. So I want to USE it.
                          6. I think it is so cool that a DOS application can shows up windows with controls and dialogs...etc.
                          7. Since there are so many people can creat win ap with VC,BCB,VB, I want to do something different.
                          8. I am a firmware engineer. I need to write some low level tool to control my USB device.
                          Win32 API level programming is enough for me. I don't need to build beautiful UI.

                          Am I answered all your questions?


                          ------------------



                          [This message has been edited by CC Tung (edited June 14, 2005).]

                          Comment


                          • #14
                            Reversing the argument..you CAN run Windows compiled console programmes in plain vanilla DOS (NOT a DOSbox, I mean in real DOS) or for for those that want to use DLL's in vanilla DOS 32 bit DPMI apps
                            see http://www.japheth.de/ Just for the heck of it I suppose..I just set up a DR-DOS 32 bit, FAT32 multitasking environment on my comp and I am itching to see what can be done with it using the multitasking API, DLL's and so on..woohoo..alas, I have given up on PB ever releasing a 32 bit PB/DOS 4..a 7 year engagement and still no date set so I'm sad to say the wedding is off Sooooo..on to FreeBasic..

                            ------------------

                            Comment


                            • #15
                              You did not have to be that complete, although your explanation is interesting.

                              All in which I was interested was if this is a "research" (educational) or "development" (application) project.

                              I devote different levels of effort to addressing the two project types.

                              MCM

                              Michael Mattias
                              Tal Systems (retired)
                              Port Washington WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #16
                                >All in which I was interested was if this is a "research" (educational) or "development" (application) project.

                                I think both of it.
                                My current project is designing a USB HID device and writing firmware of it.
                                I need to write a tool in PC (windows) to control the device. <--- "development" (application)
                                And I think if I use Visual Studio to do it will too easy to me. <--- that makes me feel bord with my job.
                                So I decide to use PB/DOS to write the tool. <--- That makes me exciting. And I judged it -- "research" (educational)



                                ------------------

                                Comment


                                • #17
                                  if you want to use DOS to control your HID device, you may use my DOSUHCI driver. This is a USB host controller driver for DOS only systems.

                                  It features an URB interface, so you can write a DOS driver for your device using this interface. It also has a trace feature in case you do not have a USB line monitor.

                                  As a sample I included PBMouse by Tony Burcham adapted for an USB mouse (a HID device). I have also done a USBView tool in PB/DOS.

                                  You may download the package from my web-page: www.georgpotthast.de/usb

                                  The driver's version is 1.0, I am still testing and improving it. As the name suggests, it will not do OHCI.



                                  ------------------

                                  Comment


                                  • #18
                                    I've downloaded your usb stuff, and began to take a look at it.
                                    Your docs mention usb drives, but I see nothing I can use to
                                    build such a driver (I've only given the package a cursory once
                                    over, so forgive me if this is answered somewhere in your docs
                                    and/or source) but I don't see anything talking about how to go
                                    about making such a driver, ghough it's mentioned several times.
                                    I'm assuming monitoring of the communications between windows
                                    and said device would be necessary first, to establish
                                    communications protocols, but I don't know enough about usb
                                    things to figure out how this could be done, any ideas?
                                    I'd like to create or find a driver that will work for flash
                                    drives (or pen drives) so I can build external storage for a
                                    proprietary note taking device I own. I could use some disk
                                    emulation software that comes with it, but if I'm going to build
                                    and sell third-party storage for these devices, I'll need
                                    something the manufacturer can't claim is theirs.

                                    ------------------
                                    http://www.windowbridge.ws for screen reading software,
                                    http://www.softcon.com
                                    for hosting/internet
                                    access.
                                    http://www.softcon.com]


                                    for hosting/internet


                                    access.

                                    Comment


                                    • #19
                                      Thank you very much for downloading the software and taking a look at it.

                                      You are correct, I did not provide information on writing a USB mass storage driver. I did not do that yet, since this a quite a lot of work to do.

                                      The specifications for USB mass storage devices can be downloaded at: http://www.usb.org/developers/devclass_docs#approved

                                      However, I expect your device to use SCSI commands within the bulk-only protocol, so you would need the SCSI commands as well. You can use USBView to read the subclass and protocol code of the interface of your device which will tell you the protocol used. A trace using SnoopyPro showing how Windows talks to your device helps to understand the specifications I mentioned.

                                      You do not need to write a driver to use the URB interface, your application program can use the URB interface as well. The samples I have provided are no TSR drivers too. I just finished a sample to print on a HP Laserjet printer and will post that in a couple of days.

                                      DosUHCI can be used to read data from a USB storage device. In your case I assume you have to send SCSI commands to your device within the USB bulk-only transport protocol.

                                      Georg


                                      ------------------

                                      Comment

                                      Working...
                                      X