Errsysw enhancement

Post Reply
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Errsysw enhancement

Post by StefanHaupt »

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

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Stefan,

Thanks! :-)

How could we translate Anwendungsdaten ? Data ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post by Detlef Hoefner »

Antonio,

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

Regards,
Detlef
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post by Detlef Hoefner »

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
Jack
Posts: 249
Joined: Wed Jul 11, 2007 11:06 am

Post by Jack »

I suppose it is Application data
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

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
Ken Wantz
Posts: 45
Joined: Wed Nov 29, 2006 7:48 pm
Location: Toronto Canada

Post by Ken Wantz »

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
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

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
Ken Wantz
Posts: 45
Joined: Wed Nov 29, 2006 7:48 pm
Location: Toronto Canada

Post by Ken Wantz »

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

"Common AppData"="C:\\Documents and Settings\\All Users\\Application Data"
And in Vista:

Code: Select all

"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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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

Post by demont frank »

I agree , i have as code :

Code: Select all

#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
Post Reply