× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Peter,

Here's a pgm that does that.  The "memcpy" function does the equivalent
of a CPYBWP (Copy Bytes With Pointers) MI instruction under the covers.

Note that pointers have to be on 16-byte boundaries.  If you declare
them as pointers in your structure (not as a string or something else)
the C compiler will align them properly, even with "_Packed".

--Dave


/*----------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <milib.h>
#include <mih/rslvsp>
#include <mih/setsppfp>

typedef _Packed struct {
   int               anInt;
  _SYSPTR            aSyp;
   char              aStr[9];
 } struc_t;

/*----------------------------------------------*/
void main(int argc, char **argv)
{
  _SYSPTR             spcSyp;
  _SPCPTR             spcSpp;
  _RSLV_Template_T    rslvTmplt;
   struc_t            struc;

  /*  Get a space ptr to the *usrspc  */

  rslvTmplt.Obj.Type_Subtype = _Usrspc;
  memset(rslvTmplt.Obj.Name, ' ', sizeof(rslvTmplt.Obj.Name));
  memcpy(rslvTmplt.Obj.Name, "AUSRSPC", 7);
  rslvTmplt.Auth = _AUTH_RETRIEVE;
  _RSLVSP2(&spcSyp, &rslvTmplt);
  spcSpp = _SETSPPFP(spcSyp);

  /*  Get a system ptr to a *pgm  */

  rslvTmplt.Obj.Type_Subtype = _Program;
  memset(rslvTmplt.Obj.Name, ' ', sizeof(rslvTmplt.Obj.Name));
  memcpy(rslvTmplt.Obj.Name, "APGM", 4);
  rslvTmplt.Auth = _AUTH_RETRIEVE;
  _RSLVSP2(&struc.aSyp, &rslvTmplt);

  memcpy(struc.aStr, "some data", 9);
  struc.anInt = 42;

  /*  Copy the structure (with the pointer) to the *usrspc  */

  memcpy(spcSpp, &struc, sizeof(struc));

  return;
}


Peter Daransky wrote:
Hi,
I try to write resolved system pointer of one object to user space ... But it doesn't work for me!? Better sayed i've a C structure with many
variables and my wish is write it complet as a block of data to user
space, so that i can later read it with the resolved pointer ... Do i need perform something special (API or MI instruction ...) ? Has someone done something similar ? A little example in C will be help :-) Thank you peter_



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.