Errsysw enhancement

Errsysw enhancement

Postby StefanHaupt » Mon Dec 22, 2008 4:43 pm

Hello to all,

the last days, I made some tests about the compatibility of fwh applications and vista and I found, the error logfile could not be written, if I follow the programming rules of vista (and XP also ! ).

The point is, that a normal user (without admin privilegs) is not allowed to write in the program directory. If we follow the programing rules, data has to be separated from the program. The applications has to be installed in the program directory and the data either in the homedir of the user or in the alluser homedir.

I made some small changes in errsysw.prg to take account of these rules.

With the new function SetErrorLog (cLogfile) you can decide, where the error.log will be written, default is the homedir of allusers.

Code: Select all  Expand view
external _fwGenError   // Link FiveWin generic Error Objects Generator

STATIC cLog    // NEW Stefan Haupt 20.12.2008

/*************
*   ErrorSys()
*
*   Note:  automatically executes at startup
*/
proc ErrorSys()
  SetErrorLog ()                  // NEW Stefan Haupt 20.12.2008
  ErrorBlock( { | e | ErrorDialog( e ) } )
return

proc ErrorLink()
return

//---------------------------------------------------
// Set errorlog file
// Stefan Haupt 20.12.2008
//---------------------------------------------------
PROCEDURE SetErrorLog (cLogFile)
  DEFAULT cLogFile := IIF (IsWinVista(), GetEnv("AllUsersProfile")+"\Error.log",;
                                        GetEnv("AllUsersProfile")+"\Anwendungsdaten\Temp\Error.log")
  cLog := cLogFile
RETURN

//---------------------------------------------------
// Get errorlog file
// Stefan Haupt 20.12.2008
//---------------------------------------------------
FUNCTION GetErrorLog ()
  RETURN (cLog)

.....
.....
// Generates a file with an Error Log

   BEGIN SEQUENCE
      oOldError = ErrorBlock( { || DoBreak() } )
      //MemoWrit( "Error.log", cErrorLog )
       MemoWrit( cLog, cErrorLog )            // NEW Stefan Haupt 20.12.2008
   END SEQUENCE
   ErrorBlock( oOldError )


kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Antonio Linares » Tue Dec 23, 2008 8:24 am

Stefan,

Thanks! :-)

How could we translate Anwendungsdaten ? Data ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Detlef Hoefner » Tue Dec 23, 2008 11:01 am

Antonio,

Anwendungsdaten means 'application data' or 'program files'.

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Antonio Linares » Tue Dec 23, 2008 11:13 am

Detlef,

Windows german uses "Anwendungsdaten" ?

If it is a different word for each country then we may need to find a way to locate such name in each language.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Detlef Hoefner » Tue Dec 23, 2008 11:26 am

Antonio,

Windows german uses "Anwendungsdaten" ?


Yes, it's used by Windows.
Here a picture

Image

This folder normally is created by the system.

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Jack » Tue Dec 23, 2008 11:47 am

I suppose it is Application data
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am

Postby StefanHaupt » Tue Dec 23, 2008 12:12 pm

Antonio,

in english versions of XP "Application Data" is correct ("Program Files" is the directory where the applications are installed), in other languages it may vary.

The name can be found in the registry

key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoamMUICache]
Entry: @shell32.dll,-21765
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Ken Wantz » Tue Dec 23, 2008 8:29 pm

Antonio,

I looked in my copy of XP Pro and @shell32.dl,-21765 was not to be found. I am suspicious any time I find an entry that has MUI and/or cache in the description.

I did find, however, Application Data at the following address in my English copy of XP Pro and Vista:

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]

In XP Pro, listed under AppData is %USERPROFILE%\Application Data but in Vista the same key lists it as %USERPROFILE%\AppData\Roaming.

Another entry in the samegroup is Local AppData. In XP Pro it is the same as before, %USERPROFILE%\Application Data but in Vista it is listed as %USERPROFILE%\AppData\Local.

I think this is a preferred place to look. Maybe others using other languages can confirm if this indeed is the place to retrieve the folder information from.

Ken
Ken Wantz
 
Posts: 45
Joined: Wed Nov 29, 2006 7:48 pm
Location: Toronto Canada

Postby StefanHaupt » Wed Dec 24, 2008 1:05 pm

Ken,

all the entries you mentioned are only for the current user, not for the the allusers account.

In the german version of XP the entry @shell32.dl,-21765 exists, but it may be that this entry is only for the translation in other languages, so it may not exist in the original english version, because you do not need it there.

It would be interesting if other users of localized version could check if this entry does exist and tell the results.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Ken Wantz » Wed Dec 24, 2008 4:08 pm

Stefan,

You are right, but I followed your lead. It might be only for a specific user, I am not aware of a Windows version that, after installation, that can run multiple default languages. While I might be barking up the wrong tree, whatever language is selected during the install would become the default language for all users.

In any case it makes sense to save the error info for each specific user. That way, if several users use the same application on the same machine, then the error might indicate all users are getting the same error or it is unique to only a specific user.

That aside, if you are looking for a more general area to save the error information, check the following key;
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

In XP Pro:
Code: Select all  Expand view
"Common AppData"="C:\\Documents and Settings\\All Users\\Application Data"


And in Vista:
Code: Select all  Expand view
"Common AppData"="C:\\ProgramData"


I guess it is whatever works best for the user/programmer as to which location to use to save the information.

Ken
Ken Wantz
 
Posts: 45
Joined: Wed Nov 29, 2006 7:48 pm
Location: Toronto Canada

Postby James Bott » Wed Dec 24, 2008 8:32 pm

Ken,

>In any case it makes sense to save the error info for each specific user. That way, if several users use the same application on the same machine, then the error might indicate all users are getting the same error or it is unique to only a specific user.

The downside of creating separate error logs for each user is that you then have to look on each local machine to find all the error logs.

It is easy enough to modify the program to save the user name with the error message and then save all the errors to the same error log.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby demont frank » Fri Dec 26, 2008 11:04 am

I agree , i have as code :
Code: Select all  Expand view
#ifndef TEST
cErFile := "ERRORS\Er" + DTOS(DATE()) + "." + CharOnly("0123456789",Time()) + ".log"
# else
cErFile := "ERRORS\Error"  + ".log"
# endif

The program dir must have subdir ERROR , in the errorfile i have the name from the user

James Bott wrote:Ken,

>In any case it makes sense to save the error info for each specific user. That way, if several users use the same application on the same machine, then the error might indicate all users are getting the same error or it is unique to only a specific user.

The downside of creating separate error logs for each user is that you then have to look on each local machine to find all the error logs.

It is easy enough to modify the program to save the user name with the error message and then save all the errors to the same error log.

Regards,
James
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests