.pa
:h4.Multi-CodePage Message Intra-Component Interfaces
:h4.***** MSG.DLL - DosIQueryMessageCP *****
.fo off
/****************************************************************************/
/*  SUBROUTINE NAME: DOSIQUERYMESSAGECP                                     */
/*                                                                          */
/*  DESCRIPTION NAME: Return code pages and language IDs.                   */
/*                                                                          */
/*  FUNCTION: Retrieves all the code pages and language IDs to the          */
/*            user given buffer.                                            */
/*                                                                          */
/*  NOTE: The filename input parameter can be of the form pathname\         */
/*        filename.                                                         */
/*                                                                          */
/*  ENTRY POINT: DOSIQUERYMESSAGECP                                         */
/*                                                                          */
/*  INPUT: DATAAREA : Message buffer address(double word)                   */
/*         DATALENGTH : Message buffer length(word)                         */
/*         FILENAME : Root message file name(double word)                   */
/*         CPLENGTH : Actual message length returned(word)                  */
/*                                                                          */
/*  EXIT-NORMAL: DATAAREA points to message buffer which contains           */
/*               the retrieved code pages and language IDs.                 */
/*                                                                          */
/*               CPLENGTH contains the actual length of the                 */
/*               returned code pages and language IDs.                      */
/*                                                                          */
/*  EXIT-ERROR:  Error setup and returned,                                  */
/*                 . Message file not found                                 */
/*                 . ERROR_BUFFER_OVERFLOW                                  */
/*                 . ERROR_MR_MID_NOT_FOUND                                 */
/*                 . ERROR_MR_UN_ACC_MSGF                                   */
/*                 . ERROR_MR_INV_MSGF_FORMAT                               */
/*                 . ERROR_MR_UN_PERFORM                                    */
/*                                                                          */
/*  SIDE EFFECTS: None.                                                     */
/*                                                                          */
/*  INTERNAL REFERENCES: TRY_RAM     : check for message in ram             */
/*                       TRY_DISK    : check for the file on disk           */
/*                                                                          */
/*  EXTERNAL REFERENCES: CHECK_DBCS,                                        */
/*                       DosFSSemRequest,                                   */
/*                       DosClose,                                          */
/*                       DosFSSemClear.                                     */
/*                                                                          */
/*  PSEUDO CODE:                                                            */
/*                                                                          */
/*  BEGIN                                                                   */
/*    EnterPROC(protect mode linkage setup)                                 */
/*    Save caller's environment                                             */
/*    Trace hook up                                                         */
/*    Call DosFSSemRequest requesting indefinite wait                       */
/*    Call check_DBCS                                                       */
/*    If DBCS                                                               */
/*    then                                                                  */
/*      Set DBCS flag on                                                    */
/*    CALL TRY_RAM                                                          */
/*    if not found then                                                     */
/*       CALL TRY_DISK                                                      */
/*    if data was found in ram or disk                                      */
/*       transfer data from temp segment to users buffer                    */
/*    move length of transfered data into users variable CPLENGTH           */
/*    If message file handle is NOT saved                                   */
/*    then                                                                  */
/*      Call DosClose                                                       */
/*    If return code is NOT OK and error code <> message too long           */
/*    then                                                                  */
/*      Call copyretmsg(return error message to user buffer)                */
/*      If return code is NOT OK                                            */
/*      then                                                                */
/*        Restore the old return code                                       */
/*    Call DosSemClear                                                      */
/*    Trace hook up                                                         */
/*    Restore caller's environment                                          */
/*  END                                                                     */
/*                                                                          */
/****************************************************************************/
.fo on
.pa
:h4.Multi-CodePage Message Intra-Component Interfaces
:h4.***** MSG.DLL - TRY_RAM  *****
.fo off
/****************************************************************************/
/*  SUBROUTINE NAME: TRY_RAM                                                */
/*                                                                          */
/*  DESCRIPTION NAME: Searches for code page info in the bound message      */
/*                    segment.                                              */
/*                                                                          */
/*  FUNCTION:  Searches the root and subfile headers for codepage info.     */
/*                                                                          */
/*                                                                          */
/*  NOTE: None.                                                             */
/*                                                                          */
/*  ENTRY POINT: TRY_RAM                                                    */
/*                                                                          */
/*  INPUT:  ARGVAR RAM_MSG,WORD    (output)  - is file in RAM?              */
/*          ARGVAR MSG_SEG,DWORD   (input )  - segment ptr to message seg   */
/*          ARGVAR TEMP_SEG,WORD   (output)  - selector of temp seg.        */
/*          ARGVAR LTEMP_SEG,WORD  (output)  - len of data in temp seg.     */
/*                                                                          */
/*                                                                          */
/*  EXIT-NORMAL: AX = 0  (file found and cpdata retrived)                   */                              */
/*                                                                          */
/*  EXIT-ERROR: Error setup and returned.                                   */
/*               . Msg segment doesn't exist                                */
/*               . insufficient memory to allocate temp buffer              */
/*               . incorrect version number                                 */
/*               . file not found                                           */
/*                                                                          */
/*  SIDE EFFECTS: None.                                                     */
/*                                                                          */
/*  INTERNAL REFERENCES: None.                                              */
/*                                                                          */
/*  EXTERNAL REFERENCES: FNSRCH:  search for filename in bound data segment */
/*                       DosAllocSeg                                        */
/*                                                                          */
/*  PSEUDO CODE:                                                            */
/*                                                                          */
/*  BEGIN                                                                   */
/*    ENTERPROC (protect mode linkage setup)                                */
/*    IF a message segment exists                                           */
/*       IF version field of header = 1  then    ;this is an old header     */
/*          rc =  error wrong version                                       */
/*       ELSE   ; this is a valid header                                    */
/*          prepare parameters to pass to FNSRCH                            */
/*          CALL FNSRCH  (in ramfind.asm)                                   */
/*          IF the filename was found    ;file was found in ram             */
/*             use BX return code from FNSRCH to create ptr to filename strc*/
/*             move ptr to code page info                                   */
/*             CALL DOSALLOCSEG to create 4k temp segment                   */
/*                  (this should allow for 200 sub-files per root)          */
/*             if no error then                                             */
/*               copy cp count into temp segment                            */
/*               while there are cp's left                                  */
/*                 copy cp info into temp segment                           */
/*               copy language family and id into temp segment              */
/*               move file ptr to point to first extended header (if exists)*/
/*               while there are sub files to process                       */
/*                   transfer cp count to temp seg                          */
/*                   while there is cp data to transfer                     */
/*                       transfer cp id's to temp seg                       */
/*                   transfer lang family/id into temp seg                  */
/*               end while                                                  */
/*               return no error                                            */
/*            else rc = error insufficient memory                           */
/*          endif ; the filename was found                                  */
/*       endelse  ; version number correct                                  */
/*    endif       ; message segment exists                                  */
/*  END           ; procedure try ram                                       */
/****************************************************************************/
.fo on
.pa
:h4.Multi-CodePage Message Intra-Component Interfaces
:h4.***** MSG.DLL - TRY_DISK *****
.fo off
/****************************************************************************/
/*  SUBROUTINE NAME: TRY_DISK                                               */
/*                                                                          */
/*  DESCRIPTION NAME:  get CP info from disk                                */
/*                                                                          */
/*  FUNCTION: searches the disk to find the file.  If the file is found     */
/*            The codepage info is returned to the caller.                  */
/*                                                                          */
/*  NOTE: NONE                                                              */
/*                                                                          */
/*  ENTRY POINT: TRY_DISK                                                   */
/*                                                                          */
/*  INPUT:  ARGVAR  FILENAME,DWORD   (input)  -ptr to asciiz filename       */
/*          ARGVAR  DATASIZE,WORD    (output) -size of returned data        */
/*          ARGVAR  TEMP_SEG,WORD    (output) -selector of temp seg         */
/*          ARGVAR  LTEMP_SEG,WORD   (output) -len of data in temp segment  */
/*                                                                          */
/*                                                                          */
/*  EXIT-NORMAL: AX = 0.                                                    */
/*                                                                          */
/*  EXIT-ERROR:  AX = file not found                                        */
/*                    invalid message file format                           */
/*                    insufficient memory                                   */
/*                                                                          */
/*                                                                          */
/*  SIDE EFFECTS: The call to VAL_FORMAT will cause the messsage file to be */
/*                opened permanently for the current process.               */
/*                                                                          */
/*  INTERNAL REFERENCES: None.                                              */
/*                                                                          */
/*  EXTERNAL REFERENCES: FIND_FILE  searches the disk for the file and      */
/*                                  returns a handle.                       */
/*                       VAl_FORMAT Checks the validity of the msg file     */
/*                                  header and stores the header inform-    */
/*                                  ation in ram.                           */
/*                       DOSALLOCSEG                                        */
/*                                                                          */
/*                                                                          */
/*  PSEUDO CODE:                                                            */
/*                                                                          */
/*                                                                          */
/*    prepare paramters to pass to FIND_FILE                                */
/*    CALL FIND_FILE                                                        */
/*    if file is found                                                      */
/*       CALL VAL_FORMAT                                                    */
/*       if file is found and no errors                                     */
/*          CALL DOSALLOCSEG to create a 4k temp segment                    */
/*          if memory allocated                                             */
/*            transfer cp count into temp segment                           */
/*            while there are code pages left                               */
/*               copy codepage info into temp segment                       */
/*            copy language family and language id into temp segment        */
/*                                                                          */
/*            get handle to file from MSGF_HEADER                           */
/*            get index of extended headers from MSGF_HEADER                */
/*            get count of extended headers from MSGF_HEADER                */
/*            seek to first extended header                                 */
/*            while there are extended headers to process                   */
/*               copy number of codepages into temp segment                 */
/*               while there are codepages to transfer                      */
/*                 copy codepage info into temp segment                     */
/*               copy lang family and id into temp segment                  */
/*               seek to next header                                        */
/*            endwhile                                                      */
/*          else return code = insufficient memory                          */
/*       else                                                               */
/*      return invalid file format                                          */
/*    else return file not found                                            */
/****************************************************************************/
.fo on
.pa
:h4.Multi-CodePage Message Intra-Component Interfaces
:h4.***** MSG.DLL - DosQueryMessageCP *****
.fo off
/****************************************************************************/
/*  SUBROUTINE NAME: DosQueryMessageCP                                      */
/*                                                                          */
/*  DESCRIPTION NAME: Passes parameters onto DOSIQUERYMESSAGECP             */
/*                                                                          */
/*  FUNCTION: This procedure takes the paramters given to DOSQUERYMESSAGECP */
/*            adds the segment selector of the bound message segment and    */
/*            passes this info onto DOSIQUERYMESSAGECP.                     */
/*                                                                          */
/*  NOTE: We do all this so that we can get a selector to the message       */
/*        segment, otherwise their is no way for msg.dll to know where      */
/*        to look for bound messages.  This is basically an exact copy      */
/*        of what DosGetMessage/DosTrueGetMessage does.                     */
/*                                                                          */
/*  ENTRY POINT: DOSQUERYMESSAGECP                                          */
/*                                                                          */
/*  INPUT: DATAAREA : Message buffer address(double word)                   */
/*         DATALENGTH : Message buffer length(word)                         */
/*         FILENAME : Root message file name(double word)                   */
/*         CPLENGTH : Actual message length returned(double word)           */
/*                                                                          */
/*  EXIT-NORMAL: These variables will be on the stack                       */
/*               DATAAREA :  DWORD                                          */
/*               DATALENGTH : WORD                                          */
/*               FILENAME :  DWORD                                          */
/*               CPLENGTH :  DWORD                                          */
/*               MSGSEG   :  DWORD                                          */
/*                                                                          */
/*  EXIT-ERROR:  None                                                       */
/*                                                                          */
/*  SIDE EFFECTS: None.                                                     */
/*                                                                          */
/*  INTERNAL REFERENCES: None.                                              */
/*                                                                          */
/*  EXTERNAL REFERENCES: None                                               */
/*                                                                          */
/*  PSEUDO CODE:                                                            */
/*                                                                          */
/*  BEGIN                                                                   */
/*                                                                          */
/*    Pass far pointer to message segment (CS:0000) as last parameter to    */
/*        DOSIQUERYMESSAGECP and restore far return address to stack        */
/*    Jump to actual procedure to do work                                   */
/*    PAD with non-zero so LINK does not trunc                              */
/****************************************************************************/
.fo on
