Re: CreateEvent and SetEvent in WinCE6.0 by vikranthgaddam
vikranthgaddam
Mon May 12 19:55:00 PDT 2008
I think so,
HANDLE hCallerProc = GetOwnerProcess();
HANDLE hCurrentProc = GetCurrentProcess();
HANDLE hLocalHandle = 0;
Also I tried by replacing GetOwnerProcess with GetCallerProcess.
"Dean Ramsier" wrote:
> I don't see any problems. Are you sure you have valid values in your
> process handles?
>
> --
> Dean Ramsier - eMVP
> BSQUARE Corporation
>
>
> "vikranth_gaddam" <vikranthgaddam@discussions.microsoft.com> wrote in
> message news:223A9B0A-93AA-4EA5-BD28-4C43E1ACCC0C@microsoft.com...
> > Thanks Ramsier
> >
> > When I modified driver code (in WinCE 5.0) to following
> >
> > if (pUData->event != NULL)
> > {
> >
> > if( !DuplicateHandle(hCallerProc, pUData->event, hCurrentProc,
> > &hLocalHandle, PROCESS_ALL_ACCESS, FALSE, DUPLICATE_SAME_ACCESS) )
> > {
> > DBG_WARNING(gDbgInfo, ("\n<---OwnerProcess: 0x%X CurrentProcess: 0x%X
> > Failed to duplicate handle: 0x%x\n", GetOwnerProcess(),
> > GetCurrentProcess(),
> > GetLastError()));
> > }
> > else
> > {
> > //code to set event.
> > }
> >
> > DuplicateHandle always returns zero with GetLastError as 0x57 (I think
> > INVALID_PARAMETER).
> >
> > I couldn't figure out what went wrong with my code.
> > Any pointers will help me a lot.
> >
> > "Dean Ramsier" wrote:
> >
> >> You need to duplicate the handle; you can't use the same event handle
> >> directly in different processes. You got away with it in CE5 (even
> >> though
> >> you shouldn't have done it) because there was a global handle table
> >> shared
> >> by all processes, but that has now changed.
> >>
> >> See DuplicateHandle() in the docs
> >>
> >> --
> >> Dean Ramsier - eMVP
> >> BSQUARE Corporation
> >>
> >>
> >> "vikranth_gaddam" <vikranthgaddam@discussions.microsoft.com> wrote in
> >> message news:B5FB0D08-1382-46CA-982C-A656BB2F2A57@microsoft.com...
> >> > Hi,
> >> >
> >> > I am a newbie to Windows Embedded CE. Try to understand Embedded :)
> >> >
> >> > I have a wince 5.0 based Application which creates a unnamed event and
> >> > sends
> >> > an IOCTL to driver.
> >> > Upon completion of requested IO, driver uses setevent on event handle
> >> > passed
> >> > by APP.
> >> > The whole thing works fine on WinCE 5.0
> >> >
> >> > Now I have this driver in wince6.0 for a different platform, when i run
> >> > the
> >> > APP (built using wince 5.0), i see exception "Abort data" in driver
> >> > (setevent, driver built using wince 6.0)
> >> >
> >> > using unnamed events is not allowed in WinCE6.0?
> >> >
> >> > If so, is there a work around for this instead of using named events?
> >> >
> >> > Any information on this would be of great help
> >> >
> >> > --Thanks in advance
> >> > Vikranth
> >>
> >>
> >>
>
>
>