From 36997d3a7db165ab85ddefab5c8a40c2f16cdf51 Mon Sep 17 00:00:00 2001 From: platon42 Date: Mon, 6 Jul 2009 14:16:27 +0000 Subject: [PATCH] Fix for AddDosNode(): When using ADNF_STARTPROC DeviceProc() was called with a casted Device * of the deviceNode pointer which was wrong in two ways: first DeviceProc() takes a STRPTR to the name and then, deviceNode is a DeviceNode pointer. Fix for MakeDosNode(): According to the Autodocs, MakeDosNode() copies all necessary structures. The implementation did not copy the DosEnvec hence the input parameter had to stay in memory. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@31546 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/expansion/adddosnode.c | 2 +- rom/expansion/makedosnode.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/rom/expansion/adddosnode.c b/rom/expansion/adddosnode.c index 6d4142e56..ff31d903e 100644 --- a/rom/expansion/adddosnode.c +++ b/rom/expansion/adddosnode.c @@ -98,7 +98,7 @@ DeviceProc() will see that dn_Device for this node is NULL and start up the handler. */ - DeviceProc((struct Device *)deviceNode); + DeviceProc(AROS_BSTR_ADDR(deviceNode->dn_Handler)); } CloseLibrary((struct Library *)DOSBase); diff --git a/rom/expansion/makedosnode.c b/rom/expansion/makedosnode.c index 32bdccad5..643330ebf 100644 --- a/rom/expansion/makedosnode.c +++ b/rom/expansion/makedosnode.c @@ -106,6 +106,8 @@ struct DeviceNode *dn; struct FileSysStartupMsg *fssm; struct DosEnvec *de; + struct DosEnvec *newde; + ULONG desize; STRPTR s1, s2 = 0; BSTR bs1, bs2; int strLen1, strLen2, sz1, sz2; @@ -118,11 +120,19 @@ /* This is the environment structure */ de = (struct DosEnvec *)((IPTR *)parmPacket + 4); - + desize = sizeof(IPTR) * (de->de_TableSize + 1); + newde = AllocMem(desize, MEMF_CLEAR | MEMF_PUBLIC); + if(de == NULL) + { + return NULL; + } + CopyMemQuick(de, newde, desize); + dn = AllocMem(sizeof(struct DeviceNode), MEMF_CLEAR | MEMF_PUBLIC); if (dn == NULL) { + FreeMem(newde, desize); return NULL; } @@ -131,6 +141,7 @@ if (fssm == NULL) { + FreeMem(newde, desize); FreeMem(dn, sizeof(struct DeviceNode)); return NULL; @@ -159,6 +170,7 @@ if (s1 == NULL) { + FreeMem(newde, desize); FreeMem(dn, sizeof(struct DeviceNode)); FreeMem(fssm, sizeof(struct FileSysStartupMsg)); @@ -187,7 +199,7 @@ /* Strings are done, now the FileSysStartupMsg */ fssm->fssm_Unit = ((IPTR *)parmPacket)[2]; fssm->fssm_Device = bs2; - fssm->fssm_Environ = MKBADDR(de); + fssm->fssm_Environ = MKBADDR(newde); fssm->fssm_Flags = ((IPTR *)parmPacket)[3]; /* FSSM is done, now the DeviceNode */ -- 2.11.4.GIT